@cumulus/aws-client 18.1.0 → 18.2.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/CloudFormation.d.ts +2 -2
- package/CloudFormation.js +2 -2
- package/CloudwatchEvents.d.ts +5 -6
- package/CloudwatchEvents.js +4 -4
- package/KMS.d.ts +2 -1
- package/KMS.js +6 -8
- package/Kinesis.d.ts +2 -1
- package/Kinesis.js +3 -2
- package/Lambda.d.ts +3 -3
- package/Lambda.js +14 -12
- package/README.md +83 -96
- package/S3.d.ts +1 -1
- package/SNS.js +1 -1
- package/SQS.d.ts +25 -7
- package/SQS.js +31 -61
- package/StepFunctions.js +3 -0
- package/package.json +23 -15
- package/services.d.ts +14 -7
- package/services.js +15 -8
- package/test-utils.d.ts +7 -7
- package/test-utils.js +7 -7
- package/types.d.ts +8 -1
package/CloudFormation.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @param {string} StackName - The name of the CloudFormation stack to query
|
|
10
10
|
* @returns {Promise<CloudFormation.Stack>} The resources belonging to the stack
|
|
11
11
|
*/
|
|
12
|
-
export declare const describeCfStack: (StackName: string) => Promise<import("aws-sdk/
|
|
12
|
+
export declare const describeCfStack: (StackName: string) => Promise<import("@aws-sdk/client-cloudformation").Stack>;
|
|
13
13
|
/**
|
|
14
14
|
* Describes the resources belonging to a given CloudFormation stack
|
|
15
15
|
*
|
|
@@ -18,7 +18,7 @@ export declare const describeCfStack: (StackName: string) => Promise<import("aws
|
|
|
18
18
|
* @param {string} StackName - The name of the CloudFormation stack to query
|
|
19
19
|
* @returns {Promise<CloudFormation.StackResources>} The resources belonging to the stack
|
|
20
20
|
*/
|
|
21
|
-
export declare const describeCfStackResources: (StackName: string) => Promise<import("aws-sdk/
|
|
21
|
+
export declare const describeCfStackResources: (StackName: string) => Promise<import("@aws-sdk/client-cloudformation").StackResource[] | undefined>;
|
|
22
22
|
/**
|
|
23
23
|
* Get parameter values for the given CloudFormation stack
|
|
24
24
|
*
|
package/CloudFormation.js
CHANGED
|
@@ -18,7 +18,7 @@ const services_1 = require("./services");
|
|
|
18
18
|
* @returns {Promise<CloudFormation.Stack>} The resources belonging to the stack
|
|
19
19
|
*/
|
|
20
20
|
const describeCfStack = async (StackName) => {
|
|
21
|
-
const response = await (0, services_1.cf)().describeStacks({ StackName })
|
|
21
|
+
const response = await (0, services_1.cf)().describeStacks({ StackName });
|
|
22
22
|
if (response.Stacks)
|
|
23
23
|
return response.Stacks[0];
|
|
24
24
|
throw new Error(`Stack not found: ${StackName}`);
|
|
@@ -33,7 +33,7 @@ exports.describeCfStack = describeCfStack;
|
|
|
33
33
|
* @returns {Promise<CloudFormation.StackResources>} The resources belonging to the stack
|
|
34
34
|
*/
|
|
35
35
|
const describeCfStackResources = async (StackName) => {
|
|
36
|
-
const response = await (0, services_1.cf)().describeStackResources({ StackName })
|
|
36
|
+
const response = await (0, services_1.cf)().describeStackResources({ StackName });
|
|
37
37
|
return response.StackResources;
|
|
38
38
|
};
|
|
39
39
|
exports.describeCfStackResources = describeCfStackResources;
|
package/CloudwatchEvents.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module CloudwatchEvents
|
|
3
3
|
*/
|
|
4
|
+
import { RuleState } from '@aws-sdk/client-cloudwatch-events';
|
|
4
5
|
/**
|
|
5
6
|
* Create a CloudWatch Events rule
|
|
6
7
|
*
|
|
@@ -11,10 +12,8 @@
|
|
|
11
12
|
* @param {string} [role] - a Role ARN
|
|
12
13
|
* @returns {Promise<CloudWatchEvents.PutRuleResponse>}
|
|
13
14
|
*/
|
|
14
|
-
export declare const putEvent: (name: string, schedule: string, state:
|
|
15
|
-
export declare const deleteEvent: (name: string) => Promise<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export declare const deleteTarget: (id: string, rule: string) => Promise<import("aws-sdk/lib/request").PromiseResult<import("aws-sdk/clients/cloudwatchevents").RemoveTargetsResponse, import("aws-sdk").AWSError>>;
|
|
19
|
-
export declare const putTarget: (rule: string, id: string, arn: string, input: string) => Promise<import("aws-sdk/lib/request").PromiseResult<import("aws-sdk/clients/cloudwatchevents").PutTargetsResponse, import("aws-sdk").AWSError>>;
|
|
15
|
+
export declare const putEvent: (name: string, schedule: string, state: RuleState, description?: string, role?: string) => Promise<import("@aws-sdk/client-cloudwatch-events").PutRuleCommandOutput>;
|
|
16
|
+
export declare const deleteEvent: (name: string) => Promise<import("@aws-sdk/client-cloudwatch-events").DeleteRuleCommandOutput>;
|
|
17
|
+
export declare const deleteTarget: (id: string, rule: string) => Promise<import("@aws-sdk/client-cloudwatch-events").RemoveTargetsCommandOutput>;
|
|
18
|
+
export declare const putTarget: (rule: string, id: string, arn: string, input: string) => Promise<import("@aws-sdk/client-cloudwatch-events").PutTargetsCommandOutput>;
|
|
20
19
|
//# sourceMappingURL=CloudwatchEvents.d.ts.map
|
package/CloudwatchEvents.js
CHANGED
|
@@ -21,14 +21,14 @@ const putEvent = (name, schedule, state, description, role) => (0, services_1.cl
|
|
|
21
21
|
RoleArn: role,
|
|
22
22
|
ScheduleExpression: schedule,
|
|
23
23
|
State: state,
|
|
24
|
-
})
|
|
24
|
+
});
|
|
25
25
|
exports.putEvent = putEvent;
|
|
26
|
-
const deleteEvent = (name) => (0, services_1.cloudwatchevents)().deleteRule({ Name: name })
|
|
26
|
+
const deleteEvent = (name) => (0, services_1.cloudwatchevents)().deleteRule({ Name: name });
|
|
27
27
|
exports.deleteEvent = deleteEvent;
|
|
28
28
|
const deleteTarget = (id, rule) => (0, services_1.cloudwatchevents)().removeTargets({
|
|
29
29
|
Ids: [id],
|
|
30
30
|
Rule: rule,
|
|
31
|
-
})
|
|
31
|
+
});
|
|
32
32
|
exports.deleteTarget = deleteTarget;
|
|
33
33
|
const putTarget = (rule, id, arn, input) => (0, services_1.cloudwatchevents)().putTargets({
|
|
34
34
|
Rule: rule,
|
|
@@ -39,6 +39,6 @@ const putTarget = (rule, id, arn, input) => (0, services_1.cloudwatchevents)().p
|
|
|
39
39
|
Input: input,
|
|
40
40
|
},
|
|
41
41
|
],
|
|
42
|
-
})
|
|
42
|
+
});
|
|
43
43
|
exports.putTarget = putTarget;
|
|
44
44
|
//# sourceMappingURL=CloudwatchEvents.js.map
|
package/KMS.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module KMS
|
|
3
3
|
*/
|
|
4
|
+
import { CreateKeyCommandInput } from '@aws-sdk/client-kms';
|
|
4
5
|
/**
|
|
5
6
|
* Create a KMS key
|
|
6
7
|
*
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
* @param {Object} params
|
|
11
12
|
* @returns {Promise<Object>}
|
|
12
13
|
*/
|
|
13
|
-
export declare const createKey: (params?:
|
|
14
|
+
export declare const createKey: (params?: CreateKeyCommandInput) => Promise<import("@aws-sdk/client-kms").CreateKeyCommandOutput>;
|
|
14
15
|
/**
|
|
15
16
|
* Encrypt a string using KMS
|
|
16
17
|
*
|
package/KMS.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module KMS
|
|
4
|
-
*/
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.decryptBase64String = exports.encrypt = exports.createKey = void 0;
|
|
7
4
|
const services_1 = require("./services");
|
|
@@ -14,7 +11,7 @@ const services_1 = require("./services");
|
|
|
14
11
|
* @param {Object} params
|
|
15
12
|
* @returns {Promise<Object>}
|
|
16
13
|
*/
|
|
17
|
-
const createKey = (params = {}) => (0, services_1.kms)().createKey(params)
|
|
14
|
+
const createKey = (params = {}) => (0, services_1.kms)().createKey(params);
|
|
18
15
|
exports.createKey = createKey;
|
|
19
16
|
/**
|
|
20
17
|
* Encrypt a string using KMS
|
|
@@ -24,10 +21,11 @@ exports.createKey = createKey;
|
|
|
24
21
|
* @returns {Promise<string>} the Base 64 encoding of the encrypted value
|
|
25
22
|
*/
|
|
26
23
|
const encrypt = async (KeyId, Plaintext) => {
|
|
27
|
-
const { CiphertextBlob } = await (0, services_1.kms)().encrypt({ KeyId,
|
|
24
|
+
const { CiphertextBlob } = await (0, services_1.kms)().encrypt({ KeyId,
|
|
25
|
+
Plaintext: new TextEncoder().encode(Plaintext) });
|
|
28
26
|
if (CiphertextBlob === undefined)
|
|
29
27
|
throw new Error('Returned CiphertextBlob is undefined');
|
|
30
|
-
return CiphertextBlob.toString('base64');
|
|
28
|
+
return Buffer.from(CiphertextBlob).toString('base64');
|
|
31
29
|
};
|
|
32
30
|
exports.encrypt = encrypt;
|
|
33
31
|
/**
|
|
@@ -39,10 +37,10 @@ exports.encrypt = encrypt;
|
|
|
39
37
|
const decryptBase64String = async (ciphertext) => {
|
|
40
38
|
const { Plaintext } = await (0, services_1.kms)().decrypt({
|
|
41
39
|
CiphertextBlob: Buffer.from(ciphertext, 'base64'),
|
|
42
|
-
})
|
|
40
|
+
});
|
|
43
41
|
if (Plaintext === undefined)
|
|
44
42
|
return undefined;
|
|
45
|
-
return Plaintext.toString();
|
|
43
|
+
return Buffer.from(Plaintext).toString();
|
|
46
44
|
};
|
|
47
45
|
exports.decryptBase64String = decryptBase64String;
|
|
48
46
|
//# sourceMappingURL=KMS.js.map
|
package/Kinesis.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module Kinesis
|
|
3
3
|
*/
|
|
4
4
|
import pRetry from 'p-retry';
|
|
5
|
+
import { DescribeStreamInput } from '@aws-sdk/client-kinesis';
|
|
5
6
|
/**
|
|
6
7
|
* Describe a Kinesis stream.
|
|
7
8
|
*
|
|
@@ -10,5 +11,5 @@ import pRetry from 'p-retry';
|
|
|
10
11
|
* @param {Object} retryOptions - Options passed to p-retry module
|
|
11
12
|
* @returns {Promise<Object>} The stream description response
|
|
12
13
|
*/
|
|
13
|
-
export declare const describeStream: (params:
|
|
14
|
+
export declare const describeStream: (params: DescribeStreamInput, retryOptions?: pRetry.Options) => Promise<import("@aws-sdk/client-kinesis").DescribeStreamCommandOutput>;
|
|
14
15
|
//# sourceMappingURL=Kinesis.d.ts.map
|
package/Kinesis.js
CHANGED
|
@@ -8,6 +8,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.describeStream = void 0;
|
|
10
10
|
const p_retry_1 = __importDefault(require("p-retry"));
|
|
11
|
+
const client_kinesis_1 = require("@aws-sdk/client-kinesis");
|
|
11
12
|
const services_1 = require("./services");
|
|
12
13
|
/**
|
|
13
14
|
* Describe a Kinesis stream.
|
|
@@ -19,10 +20,10 @@ const services_1 = require("./services");
|
|
|
19
20
|
*/
|
|
20
21
|
const describeStream = (params, retryOptions = { retries: 0 }) => (0, p_retry_1.default)(async () => {
|
|
21
22
|
try {
|
|
22
|
-
return await (0, services_1.kinesis)().describeStream(params)
|
|
23
|
+
return await (0, services_1.kinesis)().describeStream(params);
|
|
23
24
|
}
|
|
24
25
|
catch (error) {
|
|
25
|
-
if (error
|
|
26
|
+
if (error instanceof client_kinesis_1.ResourceNotFoundException)
|
|
26
27
|
throw error;
|
|
27
28
|
throw new p_retry_1.default.AbortError(error);
|
|
28
29
|
}
|
package/Lambda.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Lambda
|
|
3
3
|
*/
|
|
4
|
+
import { InvocationType } from '@aws-sdk/client-lambda';
|
|
4
5
|
/**
|
|
5
6
|
* Invoke a Lambda function
|
|
6
7
|
*
|
|
7
8
|
* @param {string} name - Lambda function name
|
|
8
9
|
* @param {any} payload - the payload to the Lambda function
|
|
9
10
|
* @param {string} type - the invocation type
|
|
10
|
-
* @returns {Promise<
|
|
11
|
-
*
|
|
11
|
+
* @returns {Promise<InvokeCommandOutput>}
|
|
12
12
|
* @alias module:Lambda.invoke
|
|
13
13
|
*/
|
|
14
|
-
export declare const invoke: (name: string, payload: unknown, type?:
|
|
14
|
+
export declare const invoke: (name: string, payload: unknown, type?: InvocationType) => Promise<false | import("@aws-sdk/client-lambda").InvokeCommandOutput>;
|
|
15
15
|
//# sourceMappingURL=Lambda.d.ts.map
|
package/Lambda.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module Lambda
|
|
4
|
-
*/
|
|
5
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
4
|
};
|
|
@@ -17,8 +14,7 @@ const log = new logger_1.default({ sender: 'aws-client/Lambda' });
|
|
|
17
14
|
* @param {string} name - Lambda function name
|
|
18
15
|
* @param {any} payload - the payload to the Lambda function
|
|
19
16
|
* @param {string} type - the invocation type
|
|
20
|
-
* @returns {Promise<
|
|
21
|
-
*
|
|
17
|
+
* @returns {Promise<InvokeCommandOutput>}
|
|
22
18
|
* @alias module:Lambda.invoke
|
|
23
19
|
*/
|
|
24
20
|
const invoke = async (name, payload, type = 'Event') => {
|
|
@@ -27,13 +23,19 @@ const invoke = async (name, payload, type = 'Event') => {
|
|
|
27
23
|
return false;
|
|
28
24
|
}
|
|
29
25
|
log.info(`Invoking ${name}`);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
let response;
|
|
27
|
+
try {
|
|
28
|
+
response = await (0, services_1.lambda)().invoke({
|
|
29
|
+
FunctionName: name,
|
|
30
|
+
Payload: new TextEncoder().encode(JSON.stringify(payload)),
|
|
31
|
+
InvocationType: type,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
log.error(`Error invoking ${name}`, error);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
return response;
|
|
37
39
|
};
|
|
38
40
|
exports.invoke = invoke;
|
|
39
41
|
//# sourceMappingURL=Lambda.js.map
|
package/README.md
CHANGED
|
@@ -35,12 +35,8 @@ NODE_ENV=test
|
|
|
35
35
|
<dd></dd>
|
|
36
36
|
<dt><a href="#module_DynamoDb">DynamoDb</a></dt>
|
|
37
37
|
<dd></dd>
|
|
38
|
-
<dt><a href="#module_KMS">KMS</a></dt>
|
|
39
|
-
<dd></dd>
|
|
40
38
|
<dt><a href="#module_Kinesis">Kinesis</a></dt>
|
|
41
39
|
<dd></dd>
|
|
42
|
-
<dt><a href="#module_Lambda">Lambda</a></dt>
|
|
43
|
-
<dd></dd>
|
|
44
40
|
<dt><a href="#module_S3">S3</a></dt>
|
|
45
41
|
<dd></dd>
|
|
46
42
|
<dt><a href="#module_SNS">SNS</a></dt>
|
|
@@ -69,6 +65,22 @@ them all into memory at once. Handles paging of listS3ObjectsV2 requests.</p>
|
|
|
69
65
|
</dd>
|
|
70
66
|
</dl>
|
|
71
67
|
|
|
68
|
+
## Functions
|
|
69
|
+
|
|
70
|
+
<dl>
|
|
71
|
+
<dt><a href="#createKey">createKey(params)</a> ⇒ <code>Promise.<Object></code></dt>
|
|
72
|
+
<dd><p>Create a KMS key</p>
|
|
73
|
+
<p>See <a href="https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/KMS.html#createKey-property">https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/KMS.html#createKey-property</a>
|
|
74
|
+
for allowed params and return value.</p>
|
|
75
|
+
</dd>
|
|
76
|
+
<dt><a href="#encrypt">encrypt(KeyId, Plaintext)</a> ⇒ <code>Promise.<string></code></dt>
|
|
77
|
+
<dd><p>Encrypt a string using KMS</p>
|
|
78
|
+
</dd>
|
|
79
|
+
<dt><a href="#decryptBase64String">decryptBase64String(ciphertext)</a> ⇒ <code>string</code></dt>
|
|
80
|
+
<dd><p>Decrypt a KMS-encrypted string, Base 64 encoded</p>
|
|
81
|
+
</dd>
|
|
82
|
+
</dl>
|
|
83
|
+
|
|
72
84
|
<a name="module_CloudFormation"></a>
|
|
73
85
|
|
|
74
86
|
## CloudFormation
|
|
@@ -228,54 +240,6 @@ See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/late
|
|
|
228
240
|
| [params.dynamoDbClient] | <code>DynamoDBDocument</code> | Instance of Dynamo DB document client |
|
|
229
241
|
| [params.retryOptions] | <code>pRetry.Options</code> | Retry options for scan operations |
|
|
230
242
|
|
|
231
|
-
<a name="module_KMS"></a>
|
|
232
|
-
|
|
233
|
-
## KMS
|
|
234
|
-
|
|
235
|
-
* [KMS](#module_KMS)
|
|
236
|
-
* [~createKey(params)](#module_KMS..createKey) ⇒ <code>Promise.<Object></code>
|
|
237
|
-
* [~encrypt(KeyId, Plaintext)](#module_KMS..encrypt) ⇒ <code>Promise.<string></code>
|
|
238
|
-
* [~decryptBase64String(ciphertext)](#module_KMS..decryptBase64String) ⇒ <code>string</code>
|
|
239
|
-
|
|
240
|
-
<a name="module_KMS..createKey"></a>
|
|
241
|
-
|
|
242
|
-
### KMS~createKey(params) ⇒ <code>Promise.<Object></code>
|
|
243
|
-
Create a KMS key
|
|
244
|
-
|
|
245
|
-
See https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/KMS.html#createKey-property
|
|
246
|
-
for allowed params and return value.
|
|
247
|
-
|
|
248
|
-
**Kind**: inner method of [<code>KMS</code>](#module_KMS)
|
|
249
|
-
|
|
250
|
-
| Param | Type |
|
|
251
|
-
| --- | --- |
|
|
252
|
-
| params | <code>Object</code> |
|
|
253
|
-
|
|
254
|
-
<a name="module_KMS..encrypt"></a>
|
|
255
|
-
|
|
256
|
-
### KMS~encrypt(KeyId, Plaintext) ⇒ <code>Promise.<string></code>
|
|
257
|
-
Encrypt a string using KMS
|
|
258
|
-
|
|
259
|
-
**Kind**: inner method of [<code>KMS</code>](#module_KMS)
|
|
260
|
-
**Returns**: <code>Promise.<string></code> - the Base 64 encoding of the encrypted value
|
|
261
|
-
|
|
262
|
-
| Param | Type | Description |
|
|
263
|
-
| --- | --- | --- |
|
|
264
|
-
| KeyId | <code>string</code> | the KMS key to use for encryption |
|
|
265
|
-
| Plaintext | <code>string</code> | the string to be encrypted |
|
|
266
|
-
|
|
267
|
-
<a name="module_KMS..decryptBase64String"></a>
|
|
268
|
-
|
|
269
|
-
### KMS~decryptBase64String(ciphertext) ⇒ <code>string</code>
|
|
270
|
-
Decrypt a KMS-encrypted string, Base 64 encoded
|
|
271
|
-
|
|
272
|
-
**Kind**: inner method of [<code>KMS</code>](#module_KMS)
|
|
273
|
-
**Returns**: <code>string</code> - the plaintext
|
|
274
|
-
|
|
275
|
-
| Param | Type | Description |
|
|
276
|
-
| --- | --- | --- |
|
|
277
|
-
| ciphertext | <code>string</code> | a KMS-encrypted value, Base 64 encoded |
|
|
278
|
-
|
|
279
243
|
<a name="module_Kinesis"></a>
|
|
280
244
|
|
|
281
245
|
## Kinesis
|
|
@@ -293,22 +257,6 @@ Describe a Kinesis stream.
|
|
|
293
257
|
| params.StreamName | <code>string</code> | A Kinesis stream name |
|
|
294
258
|
| retryOptions | <code>Object</code> | Options passed to p-retry module |
|
|
295
259
|
|
|
296
|
-
<a name="module_Lambda"></a>
|
|
297
|
-
|
|
298
|
-
## Lambda
|
|
299
|
-
<a name="module_Lambda.invoke"></a>
|
|
300
|
-
|
|
301
|
-
### Lambda.invoke(name, payload, type) ⇒ <code>Promise.<AWS.Lambda.InvocationResponse></code>
|
|
302
|
-
Invoke a Lambda function
|
|
303
|
-
|
|
304
|
-
**Kind**: static method of [<code>Lambda</code>](#module_Lambda)
|
|
305
|
-
|
|
306
|
-
| Param | Type | Default | Description |
|
|
307
|
-
| --- | --- | --- | --- |
|
|
308
|
-
| name | <code>string</code> | | Lambda function name |
|
|
309
|
-
| payload | <code>any</code> | | the payload to the Lambda function |
|
|
310
|
-
| type | <code>string</code> | <code>"Event"</code> | the invocation type |
|
|
311
|
-
|
|
312
260
|
<a name="module_S3"></a>
|
|
313
261
|
|
|
314
262
|
## S3
|
|
@@ -912,51 +860,38 @@ errors, to allow more specific handling by the caller.
|
|
|
912
860
|
|
|
913
861
|
* [SQS](#module_SQS)
|
|
914
862
|
* _static_
|
|
915
|
-
* [.sendSQSMessage](#module_SQS.sendSQSMessage) ⇒ <code>Promise</code>
|
|
916
|
-
* [.deleteSQSMessage](#module_SQS.deleteSQSMessage) ⇒ <code>Promise</code>
|
|
917
863
|
* [.createQueue(QueueName)](#module_SQS.createQueue) ⇒ <code>Promise.<string></code>
|
|
918
864
|
* _inner_
|
|
865
|
+
* [~sendSQSMessage(queueUrl, message, [logOverride])](#module_SQS..sendSQSMessage) ⇒ <code>Promise</code>
|
|
919
866
|
* [~receiveSQSMessages(queueUrl, options)](#module_SQS..receiveSQSMessages) ⇒ <code>Promise.<Array></code>
|
|
867
|
+
* [~deleteSQSMessage(queueUrl, receiptHandle)](#module_SQS..deleteSQSMessage) ⇒ <code>Promise</code>
|
|
920
868
|
* [~sqsQueueExists(queueUrl)](#module_SQS..sqsQueueExists) ⇒ <code>Promise.<boolean></code>
|
|
921
869
|
|
|
922
|
-
<a name="module_SQS.
|
|
870
|
+
<a name="module_SQS.createQueue"></a>
|
|
923
871
|
|
|
924
|
-
### SQS.
|
|
925
|
-
|
|
872
|
+
### SQS.createQueue(QueueName) ⇒ <code>Promise.<string></code>
|
|
873
|
+
Create an SQS Queue. Properly handles localstack queue URLs
|
|
926
874
|
|
|
927
|
-
**Kind**: static
|
|
928
|
-
**Returns**: <code>Promise
|
|
875
|
+
**Kind**: static method of [<code>SQS</code>](#module_SQS)
|
|
876
|
+
**Returns**: <code>Promise.<string></code> - the Queue URL
|
|
929
877
|
|
|
930
878
|
| Param | Type | Description |
|
|
931
879
|
| --- | --- | --- |
|
|
932
|
-
|
|
|
933
|
-
| message | <code>string</code> \| <code>Object</code> | either string or object message. If an object it will be serialized into a JSON string. |
|
|
934
|
-
| [logOverride] | <code>Logger</code> | optional Logger passed in for testing |
|
|
880
|
+
| QueueName | <code>string</code> | queue name |
|
|
935
881
|
|
|
936
|
-
<a name="module_SQS
|
|
882
|
+
<a name="module_SQS..sendSQSMessage"></a>
|
|
937
883
|
|
|
938
|
-
### SQS
|
|
939
|
-
|
|
884
|
+
### SQS~sendSQSMessage(queueUrl, message, [logOverride]) ⇒ <code>Promise</code>
|
|
885
|
+
Send a message to AWS SQS
|
|
940
886
|
|
|
941
|
-
**Kind**:
|
|
942
|
-
**Returns**: <code>Promise</code> -
|
|
887
|
+
**Kind**: inner method of [<code>SQS</code>](#module_SQS)
|
|
888
|
+
**Returns**: <code>Promise</code> - resolves when the messsage has been sent
|
|
943
889
|
|
|
944
890
|
| Param | Type | Description |
|
|
945
891
|
| --- | --- | --- |
|
|
946
892
|
| queueUrl | <code>string</code> | url of the SQS queue |
|
|
947
|
-
|
|
|
948
|
-
|
|
949
|
-
<a name="module_SQS.createQueue"></a>
|
|
950
|
-
|
|
951
|
-
### SQS.createQueue(QueueName) ⇒ <code>Promise.<string></code>
|
|
952
|
-
Create an SQS Queue. Properly handles localstack queue URLs
|
|
953
|
-
|
|
954
|
-
**Kind**: static method of [<code>SQS</code>](#module_SQS)
|
|
955
|
-
**Returns**: <code>Promise.<string></code> - the Queue URL
|
|
956
|
-
|
|
957
|
-
| Param | Type | Description |
|
|
958
|
-
| --- | --- | --- |
|
|
959
|
-
| QueueName | <code>string</code> | queue name |
|
|
893
|
+
| message | <code>string</code> \| <code>Object</code> | either string or object message. If an object it will be serialized into a JSON string. |
|
|
894
|
+
| [logOverride] | <code>Logger</code> | optional Logger passed in for testing |
|
|
960
895
|
|
|
961
896
|
<a name="module_SQS..receiveSQSMessages"></a>
|
|
962
897
|
|
|
@@ -975,6 +910,19 @@ can be set and the timeout is also adjustable.
|
|
|
975
910
|
| [options.visibilityTimeout] | <code>integer</code> | <code>30</code> | number of seconds a message is invisible after read |
|
|
976
911
|
| [options.waitTimeSeconds] | <code>integer</code> | <code>0</code> | number of seconds to poll SQS queue (long polling) |
|
|
977
912
|
|
|
913
|
+
<a name="module_SQS..deleteSQSMessage"></a>
|
|
914
|
+
|
|
915
|
+
### SQS~deleteSQSMessage(queueUrl, receiptHandle) ⇒ <code>Promise</code>
|
|
916
|
+
Delete a given SQS message from a given queue.
|
|
917
|
+
|
|
918
|
+
**Kind**: inner method of [<code>SQS</code>](#module_SQS)
|
|
919
|
+
**Returns**: <code>Promise</code> - an AWS SQS response
|
|
920
|
+
|
|
921
|
+
| Param | Type | Description |
|
|
922
|
+
| --- | --- | --- |
|
|
923
|
+
| queueUrl | <code>string</code> | url of the SQS queue |
|
|
924
|
+
| receiptHandle | <code>integer</code> | the unique identifier of the sQS message |
|
|
925
|
+
|
|
978
926
|
<a name="module_SQS..sqsQueueExists"></a>
|
|
979
927
|
|
|
980
928
|
### SQS~sqsQueueExists(queueUrl) ⇒ <code>Promise.<boolean></code>
|
|
@@ -1208,6 +1156,45 @@ store URL
|
|
|
1208
1156
|
| [queryParams] | <code>string</code> | a mapping of parameter key/values to put in the URL |
|
|
1209
1157
|
| presignOptions | <code>RequestPresigningArguments</code> | presignOptions |
|
|
1210
1158
|
|
|
1159
|
+
<a name="createKey"></a>
|
|
1160
|
+
|
|
1161
|
+
## createKey(params) ⇒ <code>Promise.<Object></code>
|
|
1162
|
+
Create a KMS key
|
|
1163
|
+
|
|
1164
|
+
See https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/KMS.html#createKey-property
|
|
1165
|
+
for allowed params and return value.
|
|
1166
|
+
|
|
1167
|
+
**Kind**: global function
|
|
1168
|
+
|
|
1169
|
+
| Param | Type |
|
|
1170
|
+
| --- | --- |
|
|
1171
|
+
| params | <code>Object</code> |
|
|
1172
|
+
|
|
1173
|
+
<a name="encrypt"></a>
|
|
1174
|
+
|
|
1175
|
+
## encrypt(KeyId, Plaintext) ⇒ <code>Promise.<string></code>
|
|
1176
|
+
Encrypt a string using KMS
|
|
1177
|
+
|
|
1178
|
+
**Kind**: global function
|
|
1179
|
+
**Returns**: <code>Promise.<string></code> - the Base 64 encoding of the encrypted value
|
|
1180
|
+
|
|
1181
|
+
| Param | Type | Description |
|
|
1182
|
+
| --- | --- | --- |
|
|
1183
|
+
| KeyId | <code>string</code> | the KMS key to use for encryption |
|
|
1184
|
+
| Plaintext | <code>string</code> | the string to be encrypted |
|
|
1185
|
+
|
|
1186
|
+
<a name="decryptBase64String"></a>
|
|
1187
|
+
|
|
1188
|
+
## decryptBase64String(ciphertext) ⇒ <code>string</code>
|
|
1189
|
+
Decrypt a KMS-encrypted string, Base 64 encoded
|
|
1190
|
+
|
|
1191
|
+
**Kind**: global function
|
|
1192
|
+
**Returns**: <code>string</code> - the plaintext
|
|
1193
|
+
|
|
1194
|
+
| Param | Type | Description |
|
|
1195
|
+
| --- | --- | --- |
|
|
1196
|
+
| ciphertext | <code>string</code> | a KMS-encrypted value, Base 64 encoded |
|
|
1197
|
+
|
|
1211
1198
|
|
|
1212
1199
|
## About Cumulus
|
|
1213
1200
|
|
package/S3.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ export declare const promiseS3Upload: (params: Omit<UploadOptions, 'client'>) =>
|
|
|
135
135
|
* @param {Object} uploadParams
|
|
136
136
|
* @returns {Promise}
|
|
137
137
|
*/
|
|
138
|
-
export declare const streamS3Upload: (uploadStream: Readable, uploadParams: UploadOptions) => Promise<import("@aws-sdk/client-s3").
|
|
138
|
+
export declare const streamS3Upload: (uploadStream: Readable, uploadParams: UploadOptions) => Promise<import("@aws-sdk/client-s3").CompleteMultipartUploadCommandOutput>;
|
|
139
139
|
/**
|
|
140
140
|
* Get a readable stream for an S3 object
|
|
141
141
|
*
|
package/SNS.js
CHANGED
|
@@ -28,7 +28,7 @@ const publishSnsMessage = async (snsTopicArn, message, retryOptions = {}) => awa
|
|
|
28
28
|
await (0, services_1.sns)().publish({
|
|
29
29
|
TopicArn: snsTopicArn,
|
|
30
30
|
Message: JSON.stringify(message),
|
|
31
|
-
})
|
|
31
|
+
});
|
|
32
32
|
}, {
|
|
33
33
|
maxTimeout: 5000,
|
|
34
34
|
onFailedAttempt: (err) => log.debug(`publishSnsMessage('${snsTopicArn}', '${JSON.stringify(message)}') failed with ${err.retriesLeft} retries left: ${JSON.stringify(err)}`),
|
package/SQS.d.ts
CHANGED
|
@@ -18,11 +18,31 @@ export declare const getQueueUrlByName: (queueName: string) => Promise<string |
|
|
|
18
18
|
* @static
|
|
19
19
|
*/
|
|
20
20
|
export declare function createQueue(QueueName: string): Promise<string | undefined>;
|
|
21
|
-
export declare const deleteQueue: (queueUrl: string) => Promise<
|
|
22
|
-
$response: import("aws-sdk").Response<{}, import("aws-sdk").AWSError>;
|
|
23
|
-
}>;
|
|
21
|
+
export declare const deleteQueue: (queueUrl: string) => Promise<import("@aws-sdk/client-sqs").DeleteQueueCommandOutput>;
|
|
24
22
|
export declare const getQueueAttributes: (queueName: string) => Promise<{
|
|
25
23
|
name: string;
|
|
24
|
+
All?: string | undefined;
|
|
25
|
+
ApproximateNumberOfMessages?: string | undefined;
|
|
26
|
+
ApproximateNumberOfMessagesDelayed?: string | undefined;
|
|
27
|
+
ApproximateNumberOfMessagesNotVisible?: string | undefined;
|
|
28
|
+
ContentBasedDeduplication?: string | undefined;
|
|
29
|
+
CreatedTimestamp?: string | undefined;
|
|
30
|
+
DeduplicationScope?: string | undefined;
|
|
31
|
+
DelaySeconds?: string | undefined;
|
|
32
|
+
FifoQueue?: string | undefined;
|
|
33
|
+
FifoThroughputLimit?: string | undefined;
|
|
34
|
+
KmsDataKeyReusePeriodSeconds?: string | undefined;
|
|
35
|
+
KmsMasterKeyId?: string | undefined;
|
|
36
|
+
LastModifiedTimestamp?: string | undefined;
|
|
37
|
+
MaximumMessageSize?: string | undefined;
|
|
38
|
+
MessageRetentionPeriod?: string | undefined;
|
|
39
|
+
Policy?: string | undefined;
|
|
40
|
+
QueueArn?: string | undefined;
|
|
41
|
+
ReceiveMessageWaitTimeSeconds?: string | undefined;
|
|
42
|
+
RedriveAllowPolicy?: string | undefined;
|
|
43
|
+
RedrivePolicy?: string | undefined;
|
|
44
|
+
SqsManagedSseEnabled?: string | undefined;
|
|
45
|
+
VisibilityTimeout?: string | undefined;
|
|
26
46
|
}>;
|
|
27
47
|
/**
|
|
28
48
|
* Send a message to AWS SQS
|
|
@@ -34,7 +54,7 @@ export declare const getQueueAttributes: (queueName: string) => Promise<{
|
|
|
34
54
|
* @returns {Promise} resolves when the messsage has been sent
|
|
35
55
|
|
|
36
56
|
**/
|
|
37
|
-
export declare const sendSQSMessage: (queueUrl: string, message: string | object, logOverride: Logger) => Promise<import("aws-sdk/
|
|
57
|
+
export declare const sendSQSMessage: (queueUrl: string, message: string | object, logOverride: Logger) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
|
|
38
58
|
declare type ReceiveSQSMessagesOptions = {
|
|
39
59
|
numOfMessages?: number;
|
|
40
60
|
visibilityTimeout?: number;
|
|
@@ -63,9 +83,7 @@ export declare const parseSQSMessageBody: (message: SQSRecord | AWS.SQS.Message)
|
|
|
63
83
|
* @param {integer} receiptHandle - the unique identifier of the sQS message
|
|
64
84
|
* @returns {Promise} an AWS SQS response
|
|
65
85
|
*/
|
|
66
|
-
export declare const deleteSQSMessage: (QueueUrl: string, ReceiptHandle: string) => Promise<
|
|
67
|
-
$response: import("aws-sdk").Response<{}, import("aws-sdk").AWSError>;
|
|
68
|
-
}>;
|
|
86
|
+
export declare const deleteSQSMessage: (QueueUrl: string, ReceiptHandle: string) => Promise<import("@aws-sdk/client-sqs").DeleteMessageCommandOutput>;
|
|
69
87
|
/**
|
|
70
88
|
* Test if an SQS queue exists
|
|
71
89
|
*
|
package/SQS.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
@@ -35,10 +12,8 @@ const get_1 = __importDefault(require("lodash/get"));
|
|
|
35
12
|
const isObject_1 = __importDefault(require("lodash/isObject"));
|
|
36
13
|
const isString_1 = __importDefault(require("lodash/isString"));
|
|
37
14
|
const isNil_1 = __importDefault(require("lodash/isNil"));
|
|
38
|
-
const
|
|
15
|
+
const client_sqs_1 = require("@aws-sdk/client-sqs");
|
|
39
16
|
const services_1 = require("./services");
|
|
40
|
-
const test_utils_1 = require("./test-utils");
|
|
41
|
-
const utils_1 = require("./utils");
|
|
42
17
|
const log = new logger_1.default({ sender: '@cumulus/aws-client/SQS' });
|
|
43
18
|
const getQueueNameFromUrl = (queueUrl) => queueUrl.split('/').pop();
|
|
44
19
|
exports.getQueueNameFromUrl = getQueueNameFromUrl;
|
|
@@ -48,7 +23,7 @@ const getQueueUrl = (sourceArn, queueName) => {
|
|
|
48
23
|
};
|
|
49
24
|
exports.getQueueUrl = getQueueUrl;
|
|
50
25
|
const getQueueUrlByName = async (queueName) => {
|
|
51
|
-
const response = await (0, services_1.sqs)().getQueueUrl({ QueueName: queueName })
|
|
26
|
+
const response = await (0, services_1.sqs)().getQueueUrl({ QueueName: queueName });
|
|
52
27
|
return response.QueueUrl;
|
|
53
28
|
};
|
|
54
29
|
exports.getQueueUrlByName = getQueueUrlByName;
|
|
@@ -63,33 +38,19 @@ exports.getQueueUrlByName = getQueueUrlByName;
|
|
|
63
38
|
async function createQueue(QueueName) {
|
|
64
39
|
const createQueueResponse = await (0, services_1.sqs)().createQueue({
|
|
65
40
|
QueueName,
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (createQueueResponse.QueueUrl === undefined) {
|
|
71
|
-
throw new Error('Did not receive a QueueUrl');
|
|
72
|
-
}
|
|
73
|
-
// Properly set the Queue URL. This is needed because LocalStack always
|
|
74
|
-
// returns the QueueUrl as "localhost", even if that is not where it should
|
|
75
|
-
// actually be found. CI breaks without this.
|
|
76
|
-
const returnedQueueUrl = url.parse(createQueueResponse.QueueUrl);
|
|
77
|
-
// eslint-disable-next-line unicorn/no-null
|
|
78
|
-
returnedQueueUrl.host = null;
|
|
79
|
-
if (!process.env.LOCALSTACK_HOST) {
|
|
80
|
-
throw new Error('The LOCALSTACK_HOST environment variable must be set');
|
|
81
|
-
}
|
|
82
|
-
returnedQueueUrl.hostname = process.env.LOCALSTACK_HOST;
|
|
83
|
-
return url.format(returnedQueueUrl);
|
|
84
|
-
}
|
|
41
|
+
}).catch((error) => {
|
|
42
|
+
log.error(error);
|
|
43
|
+
throw error;
|
|
44
|
+
});
|
|
85
45
|
return createQueueResponse.QueueUrl;
|
|
86
46
|
}
|
|
87
47
|
exports.createQueue = createQueue;
|
|
88
48
|
const deleteQueue = (queueUrl) => (0, services_1.sqs)().deleteQueue({
|
|
89
49
|
QueueUrl: queueUrl,
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
50
|
+
}).catch((error) => {
|
|
51
|
+
log.error(error);
|
|
52
|
+
throw error;
|
|
53
|
+
});
|
|
93
54
|
exports.deleteQueue = deleteQueue;
|
|
94
55
|
const getQueueAttributes = async (queueName) => {
|
|
95
56
|
const queueUrl = await (0, exports.getQueueUrlByName)(queueName);
|
|
@@ -99,7 +60,7 @@ const getQueueAttributes = async (queueName) => {
|
|
|
99
60
|
const response = await (0, services_1.sqs)().getQueueAttributes({
|
|
100
61
|
AttributeNames: ['All'],
|
|
101
62
|
QueueUrl: queueUrl,
|
|
102
|
-
})
|
|
63
|
+
});
|
|
103
64
|
return {
|
|
104
65
|
...response.Attributes,
|
|
105
66
|
name: queueName,
|
|
@@ -116,7 +77,7 @@ exports.getQueueAttributes = getQueueAttributes;
|
|
|
116
77
|
* @returns {Promise} resolves when the messsage has been sent
|
|
117
78
|
|
|
118
79
|
**/
|
|
119
|
-
|
|
80
|
+
const sendSQSMessage = (queueUrl, message, logOverride) => {
|
|
120
81
|
const logger = logOverride || log;
|
|
121
82
|
let messageBody;
|
|
122
83
|
if ((0, isString_1.default)(message))
|
|
@@ -128,9 +89,12 @@ exports.sendSQSMessage = (0, utils_1.improveStackTrace)((queueUrl, message, logO
|
|
|
128
89
|
return (0, services_1.sqs)().sendMessage({
|
|
129
90
|
MessageBody: messageBody,
|
|
130
91
|
QueueUrl: queueUrl,
|
|
131
|
-
}).
|
|
132
|
-
.
|
|
133
|
-
|
|
92
|
+
}).catch((error) => {
|
|
93
|
+
logger.error(error);
|
|
94
|
+
throw error;
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
exports.sendSQSMessage = sendSQSMessage;
|
|
134
98
|
/**
|
|
135
99
|
* Receives SQS messages from a given queue. The number of messages received
|
|
136
100
|
* can be set and the timeout is also adjustable.
|
|
@@ -146,14 +110,17 @@ exports.sendSQSMessage = (0, utils_1.improveStackTrace)((queueUrl, message, logO
|
|
|
146
110
|
const receiveSQSMessages = async (queueUrl, options) => {
|
|
147
111
|
const params = {
|
|
148
112
|
QueueUrl: queueUrl,
|
|
149
|
-
AttributeNames: [
|
|
113
|
+
AttributeNames: [client_sqs_1.QueueAttributeName.All],
|
|
150
114
|
// 0 is a valid value for VisibilityTimeout
|
|
151
115
|
VisibilityTimeout: (0, isNil_1.default)(options.visibilityTimeout) ? 30 : options.visibilityTimeout,
|
|
152
116
|
WaitTimeSeconds: options.waitTimeSeconds || 0,
|
|
153
117
|
MaxNumberOfMessages: options.numOfMessages || 1,
|
|
154
118
|
};
|
|
155
119
|
const messages = await (0, services_1.sqs)().receiveMessage(params)
|
|
156
|
-
.
|
|
120
|
+
.catch((error) => {
|
|
121
|
+
log.error(error);
|
|
122
|
+
throw error;
|
|
123
|
+
});
|
|
157
124
|
return (messages.Messages ?? []);
|
|
158
125
|
};
|
|
159
126
|
exports.receiveSQSMessages = receiveSQSMessages;
|
|
@@ -166,9 +133,12 @@ exports.parseSQSMessageBody = parseSQSMessageBody;
|
|
|
166
133
|
* @param {integer} receiptHandle - the unique identifier of the sQS message
|
|
167
134
|
* @returns {Promise} an AWS SQS response
|
|
168
135
|
*/
|
|
169
|
-
|
|
170
|
-
.
|
|
171
|
-
.
|
|
136
|
+
const deleteSQSMessage = (QueueUrl, ReceiptHandle) => (0, services_1.sqs)().deleteMessage({ QueueUrl, ReceiptHandle })
|
|
137
|
+
.catch((error) => {
|
|
138
|
+
log.error(error);
|
|
139
|
+
throw error;
|
|
140
|
+
});
|
|
141
|
+
exports.deleteSQSMessage = deleteSQSMessage;
|
|
172
142
|
/**
|
|
173
143
|
* Test if an SQS queue exists
|
|
174
144
|
*
|
|
@@ -182,11 +152,11 @@ const sqsQueueExists = async (queueUrl) => {
|
|
|
182
152
|
throw new Error(`Unable to determine QueueName from ${queueUrl}`);
|
|
183
153
|
}
|
|
184
154
|
try {
|
|
185
|
-
await (0, services_1.sqs)().getQueueUrl({ QueueName })
|
|
155
|
+
await (0, services_1.sqs)().getQueueUrl({ QueueName });
|
|
186
156
|
return true;
|
|
187
157
|
}
|
|
188
158
|
catch (error) {
|
|
189
|
-
if (error.
|
|
159
|
+
if (error.name === 'QueueDoesNotExist') {
|
|
190
160
|
log.warn(`Queue ${QueueName} does not exist`);
|
|
191
161
|
return false;
|
|
192
162
|
}
|
package/StepFunctions.js
CHANGED
|
@@ -6,12 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.listExecutions = exports.getExecutionStatus = exports.getExecutionHistory = exports.executionExists = exports.describeStateMachine = exports.describeExecution = exports.doesExecutionExist = void 0;
|
|
7
7
|
const services_1 = require("./services");
|
|
8
8
|
const utils_1 = require("./utils");
|
|
9
|
+
const test_utils_1 = require("./test-utils");
|
|
9
10
|
// Utility functions
|
|
10
11
|
const doesExecutionExist = (describeExecutionPromise) => describeExecutionPromise
|
|
11
12
|
.then(() => true)
|
|
12
13
|
.catch((error) => {
|
|
13
14
|
if (error.code === 'ExecutionDoesNotExist')
|
|
14
15
|
return false;
|
|
16
|
+
if ((0, test_utils_1.inTestMode)() && error.code === 'InvalidName')
|
|
17
|
+
return false;
|
|
15
18
|
throw error;
|
|
16
19
|
});
|
|
17
20
|
exports.doesExecutionExist = doesExecutionExist;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/aws-client",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.2.0",
|
|
4
4
|
"description": "Utilities for working with AWS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -44,19 +44,26 @@
|
|
|
44
44
|
"author": "Cumulus Authors",
|
|
45
45
|
"license": "Apache-2.0",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@aws-sdk/client-api-gateway": "^3.
|
|
48
|
-
"@aws-sdk/client-
|
|
49
|
-
"@aws-sdk/client-
|
|
50
|
-
"@aws-sdk/client-
|
|
51
|
-
"@aws-sdk/
|
|
52
|
-
"@aws-sdk/
|
|
53
|
-
"@aws-sdk/
|
|
54
|
-
"@aws-sdk/
|
|
55
|
-
"@aws-sdk/
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"aws-sdk": "^
|
|
47
|
+
"@aws-sdk/client-api-gateway": "^3.499.0",
|
|
48
|
+
"@aws-sdk/client-cloudformation": "^3.447.0",
|
|
49
|
+
"@aws-sdk/client-cloudwatch-events": "^3.447.0",
|
|
50
|
+
"@aws-sdk/client-dynamodb": "^3.447.0",
|
|
51
|
+
"@aws-sdk/client-dynamodb-streams": "^3.447.0",
|
|
52
|
+
"@aws-sdk/client-kinesis": "^3.447.0",
|
|
53
|
+
"@aws-sdk/client-kms": "^3.447.0",
|
|
54
|
+
"@aws-sdk/client-lambda": "^3.447.0",
|
|
55
|
+
"@aws-sdk/client-s3": "^3.447.0",
|
|
56
|
+
"@aws-sdk/client-sns": "^3.447.0",
|
|
57
|
+
"@aws-sdk/client-sqs": "^3.447.0",
|
|
58
|
+
"@aws-sdk/lib-dynamodb": "^3.447.0",
|
|
59
|
+
"@aws-sdk/lib-storage": "^3.447.0",
|
|
60
|
+
"@aws-sdk/s3-request-presigner": "^3.447.0",
|
|
61
|
+
"@aws-sdk/signature-v4-crt": "^3.447.0",
|
|
62
|
+
"@aws-sdk/types": "^3.447.0",
|
|
63
|
+
"@cumulus/checksum": "18.2.0",
|
|
64
|
+
"@cumulus/errors": "18.2.0",
|
|
65
|
+
"@cumulus/logger": "18.2.0",
|
|
66
|
+
"aws-sdk": "^2.1492.0",
|
|
60
67
|
"jsonpath-plus": "^1.1.0",
|
|
61
68
|
"lodash": "~4.17.21",
|
|
62
69
|
"mem": "^8.0.2",
|
|
@@ -68,7 +75,8 @@
|
|
|
68
75
|
"uuid": "^8.2.0"
|
|
69
76
|
},
|
|
70
77
|
"devDependencies": {
|
|
78
|
+
"@cumulus/test-data": "18.0.0",
|
|
71
79
|
"@types/uuid": "^8.0.0"
|
|
72
80
|
},
|
|
73
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "c3b3d1a8accfbd53df89382ba2e9fa7dcbf46b6e"
|
|
74
82
|
}
|
package/services.d.ts
CHANGED
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
import { APIGatewayClient } from '@aws-sdk/client-api-gateway';
|
|
2
|
+
import { CloudFormation } from '@aws-sdk/client-cloudformation';
|
|
2
3
|
import { DynamoDB } from '@aws-sdk/client-dynamodb';
|
|
3
4
|
import { DynamoDBStreamsClient } from '@aws-sdk/client-dynamodb-streams';
|
|
5
|
+
import { Kinesis } from '@aws-sdk/client-kinesis';
|
|
6
|
+
import { KMS } from '@aws-sdk/client-kms';
|
|
7
|
+
import { Lambda } from '@aws-sdk/client-lambda';
|
|
8
|
+
import { CloudWatchEvents } from '@aws-sdk/client-cloudwatch-events';
|
|
4
9
|
import { S3 } from '@aws-sdk/client-s3';
|
|
10
|
+
import { SQS } from '@aws-sdk/client-sqs';
|
|
5
11
|
import { DynamoDBDocument, TranslateConfig } from '@aws-sdk/lib-dynamodb';
|
|
12
|
+
import { SNS } from '@aws-sdk/client-sns';
|
|
6
13
|
import * as AWS from 'aws-sdk';
|
|
7
14
|
export declare const apigateway: (params?: object | undefined) => APIGatewayClient;
|
|
8
15
|
export declare const ecs: (params?: object | undefined) => AWS.ECS;
|
|
9
16
|
export declare const ec2: (params?: object | undefined) => AWS.EC2;
|
|
10
17
|
export declare const s3: (params?: object | undefined) => S3;
|
|
11
|
-
export declare const kinesis: (params?: object | undefined) =>
|
|
12
|
-
export declare const lambda: (params?: object | undefined) =>
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
18
|
+
export declare const kinesis: (params?: object | undefined) => Kinesis;
|
|
19
|
+
export declare const lambda: (params?: object | undefined) => Lambda;
|
|
20
|
+
export declare const cloudwatchevents: (params?: object | undefined) => CloudWatchEvents;
|
|
21
|
+
export declare const sqs: (params?: object | undefined) => SQS;
|
|
15
22
|
export declare const cloudwatchlogs: (params?: object | undefined) => AWS.CloudWatchLogs;
|
|
16
23
|
export declare const cloudwatch: (params?: object | undefined) => AWS.CloudWatch;
|
|
17
24
|
export declare const dynamodb: (params?: object | undefined) => DynamoDB;
|
|
18
25
|
export declare const dynamodbstreams: (params?: object | undefined) => DynamoDBStreamsClient;
|
|
19
26
|
export declare const dynamodbDocClient: (docClientOptions?: TranslateConfig, dynamoOptions?: object) => DynamoDBDocument;
|
|
20
27
|
export declare const sfn: (params?: object | undefined) => AWS.StepFunctions;
|
|
21
|
-
export declare const cf: (params?: object | undefined) =>
|
|
22
|
-
export declare const sns: (params?: object | undefined) =>
|
|
28
|
+
export declare const cf: (params?: object | undefined) => CloudFormation;
|
|
29
|
+
export declare const sns: (params?: object | undefined) => SNS;
|
|
23
30
|
export declare const secretsManager: (params?: object | undefined) => AWS.SecretsManager;
|
|
24
31
|
export declare const systemsManager: (params?: object | undefined) => AWS.SSM;
|
|
25
|
-
export declare const kms: (params?: object | undefined) =>
|
|
32
|
+
export declare const kms: (params?: object | undefined) => KMS;
|
|
26
33
|
export declare const es: (params?: object | undefined) => AWS.ES;
|
|
27
34
|
export declare const sts: (params?: object | undefined) => AWS.STS;
|
|
28
35
|
//# sourceMappingURL=services.d.ts.map
|
package/services.js
CHANGED
|
@@ -26,22 +26,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.sts = exports.es = exports.kms = exports.systemsManager = exports.secretsManager = exports.sns = exports.cf = exports.sfn = exports.dynamodbDocClient = exports.dynamodbstreams = exports.dynamodb = exports.cloudwatch = exports.cloudwatchlogs = exports.
|
|
29
|
+
exports.sts = exports.es = exports.kms = exports.systemsManager = exports.secretsManager = exports.sns = exports.cf = exports.sfn = exports.dynamodbDocClient = exports.dynamodbstreams = exports.dynamodb = exports.cloudwatch = exports.cloudwatchlogs = exports.sqs = exports.cloudwatchevents = exports.lambda = exports.kinesis = exports.s3 = exports.ec2 = exports.ecs = exports.apigateway = void 0;
|
|
30
30
|
const client_api_gateway_1 = require("@aws-sdk/client-api-gateway");
|
|
31
|
+
const client_cloudformation_1 = require("@aws-sdk/client-cloudformation");
|
|
31
32
|
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
32
33
|
const client_dynamodb_streams_1 = require("@aws-sdk/client-dynamodb-streams");
|
|
34
|
+
const client_kinesis_1 = require("@aws-sdk/client-kinesis");
|
|
35
|
+
const client_kms_1 = require("@aws-sdk/client-kms");
|
|
36
|
+
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
37
|
+
const client_cloudwatch_events_1 = require("@aws-sdk/client-cloudwatch-events");
|
|
33
38
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
39
|
+
const client_sqs_1 = require("@aws-sdk/client-sqs");
|
|
34
40
|
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
41
|
+
const client_sns_1 = require("@aws-sdk/client-sns");
|
|
35
42
|
const AWS = __importStar(require("aws-sdk"));
|
|
36
43
|
const client_1 = __importDefault(require("./client"));
|
|
37
44
|
exports.apigateway = (0, client_1.default)(client_api_gateway_1.APIGatewayClient, '2015-07-09');
|
|
38
45
|
exports.ecs = (0, client_1.default)(AWS.ECS, '2014-11-13');
|
|
39
46
|
exports.ec2 = (0, client_1.default)(AWS.EC2, '2016-11-15');
|
|
40
47
|
exports.s3 = (0, client_1.default)(client_s3_1.S3, '2006-03-01');
|
|
41
|
-
exports.kinesis = (0, client_1.default)(
|
|
42
|
-
exports.lambda = (0, client_1.default)(
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
48
|
+
exports.kinesis = (0, client_1.default)(client_kinesis_1.Kinesis, '2013-12-02');
|
|
49
|
+
exports.lambda = (0, client_1.default)(client_lambda_1.Lambda, '2015-03-31');
|
|
50
|
+
exports.cloudwatchevents = (0, client_1.default)(client_cloudwatch_events_1.CloudWatchEvents, '2015-10-07');
|
|
51
|
+
exports.sqs = (0, client_1.default)(client_sqs_1.SQS, '2012-11-05');
|
|
45
52
|
exports.cloudwatchlogs = (0, client_1.default)(AWS.CloudWatchLogs, '2014-03-28');
|
|
46
53
|
exports.cloudwatch = (0, client_1.default)(AWS.CloudWatch, '2010-08-01');
|
|
47
54
|
exports.dynamodb = (0, client_1.default)(client_dynamodb_1.DynamoDB, '2012-08-10');
|
|
@@ -49,11 +56,11 @@ exports.dynamodbstreams = (0, client_1.default)(client_dynamodb_streams_1.Dynamo
|
|
|
49
56
|
const dynamodbDocClient = (docClientOptions, dynamoOptions) => lib_dynamodb_1.DynamoDBDocument.from((0, client_1.default)(client_dynamodb_1.DynamoDB, '2012-08-10')(dynamoOptions), docClientOptions);
|
|
50
57
|
exports.dynamodbDocClient = dynamodbDocClient;
|
|
51
58
|
exports.sfn = (0, client_1.default)(AWS.StepFunctions, '2016-11-23');
|
|
52
|
-
exports.cf = (0, client_1.default)(
|
|
53
|
-
exports.sns = (0, client_1.default)(
|
|
59
|
+
exports.cf = (0, client_1.default)(client_cloudformation_1.CloudFormation, '2010-05-15');
|
|
60
|
+
exports.sns = (0, client_1.default)(client_sns_1.SNS, '2010-03-31');
|
|
54
61
|
exports.secretsManager = (0, client_1.default)(AWS.SecretsManager, '2017-10-17');
|
|
55
62
|
exports.systemsManager = (0, client_1.default)(AWS.SSM, '2017-10-17');
|
|
56
|
-
exports.kms = (0, client_1.default)(
|
|
63
|
+
exports.kms = (0, client_1.default)(client_kms_1.KMS, '2014-11-01');
|
|
57
64
|
exports.es = (0, client_1.default)(AWS.ES, '2015-01-01');
|
|
58
65
|
exports.sts = (0, client_1.default)(AWS.STS, '2011-06-15');
|
|
59
66
|
//# sourceMappingURL=services.js.map
|
package/test-utils.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ export declare const inTestMode: () => boolean;
|
|
|
4
4
|
declare const localStackPorts: {
|
|
5
5
|
stepfunctions: number;
|
|
6
6
|
APIGatewayClient: number;
|
|
7
|
-
|
|
7
|
+
CloudFormation: number;
|
|
8
8
|
cloudwatch: number;
|
|
9
|
-
|
|
9
|
+
CloudWatchEvents: number;
|
|
10
10
|
cloudwatchlogs: number;
|
|
11
11
|
DynamoDB: number;
|
|
12
12
|
DynamoDBClient: number;
|
|
@@ -16,16 +16,16 @@ declare const localStackPorts: {
|
|
|
16
16
|
es: number;
|
|
17
17
|
firehose: number;
|
|
18
18
|
iam: number;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
Kinesis: number;
|
|
20
|
+
KMS: number;
|
|
21
|
+
Lambda: number;
|
|
22
22
|
redshift: number;
|
|
23
23
|
route53: number;
|
|
24
24
|
S3: number;
|
|
25
25
|
secretsmanager: number;
|
|
26
26
|
ses: number;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
SNS: number;
|
|
28
|
+
SQS: number;
|
|
29
29
|
ssm: number;
|
|
30
30
|
sts: number;
|
|
31
31
|
};
|
package/test-utils.js
CHANGED
|
@@ -9,9 +9,9 @@ exports.inTestMode = inTestMode;
|
|
|
9
9
|
const localStackPorts = {
|
|
10
10
|
stepfunctions: 4566,
|
|
11
11
|
APIGatewayClient: 4566,
|
|
12
|
-
|
|
12
|
+
CloudFormation: 4566,
|
|
13
13
|
cloudwatch: 4566,
|
|
14
|
-
|
|
14
|
+
CloudWatchEvents: 4566,
|
|
15
15
|
cloudwatchlogs: 4566,
|
|
16
16
|
DynamoDB: 4566,
|
|
17
17
|
DynamoDBClient: 4566,
|
|
@@ -21,16 +21,16 @@ const localStackPorts = {
|
|
|
21
21
|
es: 4566,
|
|
22
22
|
firehose: 4566,
|
|
23
23
|
iam: 4566,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
Kinesis: 4566,
|
|
25
|
+
KMS: 4566,
|
|
26
|
+
Lambda: 4566,
|
|
27
27
|
redshift: 4566,
|
|
28
28
|
route53: 4566,
|
|
29
29
|
S3: 4566,
|
|
30
30
|
secretsmanager: 4566,
|
|
31
31
|
ses: 4566,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
SNS: 4566,
|
|
33
|
+
SQS: 4566,
|
|
34
34
|
ssm: 4566,
|
|
35
35
|
sts: 4566,
|
|
36
36
|
};
|
package/types.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import * as AWS from 'aws-sdk';
|
|
2
2
|
import { APIGatewayClient } from '@aws-sdk/client-api-gateway';
|
|
3
|
+
import { CloudWatchEvents } from '@aws-sdk/client-cloudwatch-events';
|
|
4
|
+
import { CloudFormation } from '@aws-sdk/client-cloudformation';
|
|
3
5
|
import { DynamoDBStreamsClient } from '@aws-sdk/client-dynamodb-streams';
|
|
4
6
|
import { DynamoDB, DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
7
|
+
import { Kinesis } from '@aws-sdk/client-kinesis';
|
|
8
|
+
import { KMS } from '@aws-sdk/client-kms';
|
|
9
|
+
import { Lambda } from '@aws-sdk/client-lambda';
|
|
5
10
|
import { S3 } from '@aws-sdk/client-s3';
|
|
6
|
-
|
|
11
|
+
import { SNS } from '@aws-sdk/client-sns';
|
|
12
|
+
import { SQS } from '@aws-sdk/client-sqs';
|
|
13
|
+
export declare type AWSClientTypes = APIGatewayClient | CloudFormation | CloudWatchEvents | DynamoDB | DynamoDBClient | DynamoDBStreamsClient | KMS | Kinesis | Lambda | S3 | SNS | SQS | AWS.Service | AWS.DynamoDB.DocumentClient;
|
|
7
14
|
//# sourceMappingURL=types.d.ts.map
|