@cumulus/aws-client 18.2.1 → 18.2.2

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.
Files changed (4) hide show
  1. package/README.md +17 -5
  2. package/SNS.d.ts +9 -0
  3. package/SNS.js +16 -1
  4. package/package.json +5 -5
package/README.md CHANGED
@@ -43,8 +43,6 @@ NODE_ENV=test
43
43
  <dd></dd>
44
44
  <dt><a href="#module_SQS">SQS</a></dt>
45
45
  <dd></dd>
46
- <dt><a href="#module_STS">STS</a></dt>
47
- <dd></dd>
48
46
  <dt><a href="#module_SecretsManager">SecretsManager</a></dt>
49
47
  <dd></dd>
50
48
  <dt><a href="#module_StepFunctions">StepFunctions</a></dt>
@@ -842,6 +840,11 @@ Move an S3 object to another location in S3
842
840
  <a name="module_SNS"></a>
843
841
 
844
842
  ## SNS
843
+
844
+ * [SNS](#module_SNS)
845
+ * [~publishSnsMessage(snsTopicArn, message, retryOptions)](#module_SNS..publishSnsMessage) ⇒ <code>Promise.&lt;undefined&gt;</code>
846
+ * [~createSnsTopic(snsTopicName)](#module_SNS..createSnsTopic) ⇒
847
+
845
848
  <a name="module_SNS..publishSnsMessage"></a>
846
849
 
847
850
  ### SNS~publishSnsMessage(snsTopicArn, message, retryOptions) ⇒ <code>Promise.&lt;undefined&gt;</code>
@@ -856,6 +859,18 @@ errors, to allow more specific handling by the caller.
856
859
  | message | <code>Object</code> | Message object |
857
860
  | retryOptions | <code>Object</code> | options to control retry behavior when publishing a message fails. See https://github.com/tim-kos/node-retry#retryoperationoptions |
858
861
 
862
+ <a name="module_SNS..createSnsTopic"></a>
863
+
864
+ ### SNS~createSnsTopic(snsTopicName) ⇒
865
+ Create an SNS topic with a given name.
866
+
867
+ **Kind**: inner method of [<code>SNS</code>](#module_SNS)
868
+ **Returns**: - ARN of the created SNS topic
869
+
870
+ | Param | Description |
871
+ | --- | --- |
872
+ | snsTopicName | Name of the SNS topic |
873
+
859
874
  <a name="module_SQS"></a>
860
875
 
861
876
  ## SQS
@@ -938,9 +953,6 @@ Test if an SQS queue exists
938
953
  | --- | --- | --- |
939
954
  | queueUrl | <code>Object</code> | queue url |
940
955
 
941
- <a name="module_STS"></a>
942
-
943
- ## STS
944
956
  <a name="module_SecretsManager"></a>
945
957
 
946
958
  ## SecretsManager
package/SNS.d.ts CHANGED
@@ -12,4 +12,13 @@
12
12
  * @returns {Promise<undefined>}
13
13
  */
14
14
  export declare const publishSnsMessage: (snsTopicArn: string, message: any, retryOptions?: {}) => Promise<void>;
15
+ /**
16
+ * Create an SNS topic with a given name.
17
+ *
18
+ * @param snsTopicName - Name of the SNS topic
19
+ * @returns - ARN of the created SNS topic
20
+ */
21
+ export declare const createSnsTopic: (snsTopicName: string) => Promise<{
22
+ TopicArn: string | undefined;
23
+ }>;
15
24
  //# sourceMappingURL=SNS.d.ts.map
package/SNS.js CHANGED
@@ -6,7 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  return (mod && mod.__esModule) ? mod : { "default": mod };
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.publishSnsMessage = void 0;
9
+ exports.createSnsTopic = exports.publishSnsMessage = void 0;
10
10
  const p_retry_1 = __importDefault(require("p-retry"));
11
11
  const logger_1 = __importDefault(require("@cumulus/logger"));
12
12
  const services_1 = require("./services");
@@ -35,4 +35,19 @@ const publishSnsMessage = async (snsTopicArn, message, retryOptions = {}) => awa
35
35
  ...retryOptions,
36
36
  });
37
37
  exports.publishSnsMessage = publishSnsMessage;
38
+ /**
39
+ * Create an SNS topic with a given name.
40
+ *
41
+ * @param snsTopicName - Name of the SNS topic
42
+ * @returns - ARN of the created SNS topic
43
+ */
44
+ const createSnsTopic = async (snsTopicName) => {
45
+ const createTopicInput = {
46
+ Name: snsTopicName,
47
+ KmsMasterKeyId: 'alias/aws/sns',
48
+ };
49
+ const createTopicResponse = await (0, services_1.sns)().createTopic(createTopicInput);
50
+ return { TopicArn: createTopicResponse.TopicArn };
51
+ };
52
+ exports.createSnsTopic = createSnsTopic;
38
53
  //# sourceMappingURL=SNS.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulus/aws-client",
3
- "version": "18.2.1",
3
+ "version": "18.2.2",
4
4
  "description": "Utilities for working with AWS",
5
5
  "keywords": [
6
6
  "GIBS",
@@ -60,9 +60,9 @@
60
60
  "@aws-sdk/s3-request-presigner": "^3.447.0",
61
61
  "@aws-sdk/signature-v4-crt": "^3.447.0",
62
62
  "@aws-sdk/types": "^3.447.0",
63
- "@cumulus/checksum": "18.2.1",
64
- "@cumulus/errors": "18.2.1",
65
- "@cumulus/logger": "18.2.1",
63
+ "@cumulus/checksum": "18.2.2",
64
+ "@cumulus/errors": "18.2.2",
65
+ "@cumulus/logger": "18.2.2",
66
66
  "aws-sdk": "^2.1492.0",
67
67
  "jsonpath-plus": "^1.1.0",
68
68
  "lodash": "~4.17.21",
@@ -78,5 +78,5 @@
78
78
  "@cumulus/test-data": "18.0.0",
79
79
  "@types/uuid": "^8.0.0"
80
80
  },
81
- "gitHead": "be885e09333228fd5b42ae2319783b557422cbf8"
81
+ "gitHead": "d2f030f1d77b6d3072cb20f84261b10a7b160620"
82
82
  }