@cumulus/aws-client 18.2.0 → 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 -0
  2. package/SNS.d.ts +9 -0
  3. package/SNS.js +16 -1
  4. package/package.json +5 -5
package/README.md CHANGED
@@ -840,6 +840,11 @@ Move an S3 object to another location in S3
840
840
  <a name="module_SNS"></a>
841
841
 
842
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
+
843
848
  <a name="module_SNS..publishSnsMessage"></a>
844
849
 
845
850
  ### SNS~publishSnsMessage(snsTopicArn, message, retryOptions) ⇒ <code>Promise.&lt;undefined&gt;</code>
@@ -854,6 +859,18 @@ errors, to allow more specific handling by the caller.
854
859
  | message | <code>Object</code> | Message object |
855
860
  | retryOptions | <code>Object</code> | options to control retry behavior when publishing a message fails. See https://github.com/tim-kos/node-retry#retryoperationoptions |
856
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
+
857
874
  <a name="module_SQS"></a>
858
875
 
859
876
  ## SQS
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.0",
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.0",
64
- "@cumulus/errors": "18.2.0",
65
- "@cumulus/logger": "18.2.0",
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": "c3b3d1a8accfbd53df89382ba2e9fa7dcbf46b6e"
81
+ "gitHead": "d2f030f1d77b6d3072cb20f84261b10a7b160620"
82
82
  }