@itentialopensource/adapter-amazon_route53 0.2.1 → 0.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.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,15 @@
1
1
 
2
+ ## 0.2.2 [07-14-2022]
3
+
4
+ * patch/Auth - Auth changes
5
+
6
+ See merge request itentialopensource/adapters/cloud/adapter-amazon_route53!3
7
+
8
+ ---
9
+
2
10
  ## 0.2.1 [06-24-2022]
3
11
 
4
- * Auth Changes for Headers and Streamline
12
+ - Auth Changes for Headers and Streamline
5
13
 
6
14
  See merge request itentialopensource/adapters/cloud/adapter-amazon_route53!2
7
15
 
@@ -9,7 +17,29 @@ See merge request itentialopensource/adapters/cloud/adapter-amazon_route53!2
9
17
 
10
18
  ## 0.2.0 [05-15-2022]
11
19
 
12
- * Changes for Auth and migration
20
+ - Changes for STS Auth, IAM and Migration
21
+ - Add some items to .gitignore (e.g. DS_Store) to keep them out of the repos.
22
+ - Changes to the README (some typo fixes - Add how to extend the adapter). Split the README into various markdown files (AUTH, BROKER, CALLS, ENHANCE, PROPERTIES, SUMMARY, SYSTEMINFO, TROUBLESHOOT)
23
+ - Fix the issues with Confluence in the markdowns (Tables, Lists, Links)
24
+ - Add scripts for easier authentication, removing hooks, etc
25
+ - Script changes (install script as well as database changes in other scripts)
26
+ - Double # of path vars on generic call
27
+ - Update versions of foundation (e.g. adapter-utils)
28
+ - Update npm publish so it supports https
29
+ - Update dependencies
30
+ - Add preinstall for minimist
31
+ - Fix new lint issues that came from eslint dependency change
32
+ - Add more thorough Unit tests for standard files (Package, Pronghorn, Properties (Schema and Sample)
33
+ - Add the adapter type in the package.json
34
+ - Add AdapterInfo.js script
35
+ - Add json-query dependency
36
+ - Add the propertiesDecorators.json for product encryption
37
+ - Change the name of internal IAP/Adapter methods to avoid collisions and make more obvious in Workflow - iapRunAdapterBasicGet, iapRunAdapterConnectivity, iapRunAdapterHealthcheck, iapTroubleshootAdapter, iapGetAdapterQueue, iapUnsuspendAdapter, iapSuspendAdapter, iapFindAdapterPath, iapUpdateAdapterConfiguration, iapGetAdapterWorkflowFunctions
38
+ - Add the adapter config in the database support - iapMoveAdapterEntitiesToDB
39
+ - Add standard broker calls - hasEntities, getDevice, getDevicesFiltered, isAlive, getConfig and iapGetDeviceCount
40
+ - Add genericAdapterRequest that does not use the base_path and version so that the path can be unique - genericAdapterRequestNoBasePath
41
+ - Add AdapterInfo.json
42
+ - Add systemName for documentation
13
43
 
14
44
  See merge request itentialopensource/adapters/cloud/adapter-amazon_route53!1
15
45
 
package/adapter.js CHANGED
@@ -31,7 +31,7 @@ class AmazonRoute53 extends AdapterBaseCl {
31
31
  // Instantiate the AdapterBase super class
32
32
  super(prongid, properties);
33
33
 
34
- const restFunctionNames = this.getWorkflowFunctions();
34
+ const restFunctionNames = this.iapGetAdapterWorkflowFunctions();
35
35
 
36
36
  // Dynamically bind emit functions
37
37
  for (let i = 0; i < restFunctionNames.length; i += 1) {
@@ -914,7 +914,7 @@ class AmazonRoute53 extends AdapterBaseCl {
914
914
  sessionToken: this.allProps.authentication.aws_session_token,
915
915
  accessKeyId: this.allProps.authentication.aws_access_key,
916
916
  secretAccessKey: this.allProps.authentication.aws_secret_key,
917
- region: this.allProps.authentication.region
917
+ region: this.allProps.region
918
918
  });
919
919
 
920
920
  // use STS to get the AWS access information for the user defined in STWS Params
@@ -973,6 +973,9 @@ class AmazonRoute53 extends AdapterBaseCl {
973
973
  if (error1) {
974
974
  return callback(null, error1);
975
975
  }
976
+ if (!response || !response.body) {
977
+ return callback(null, 'No Authentication Token');
978
+ }
976
979
  const tokenKey = response.body;
977
980
  const toptions = {
978
981
  method: 'GET',
@@ -981,21 +984,29 @@ class AmazonRoute53 extends AdapterBaseCl {
981
984
  'X-aws-ec2-metadata-token': tokenKey
982
985
  }
983
986
  };
984
- log.info(toptions);
987
+ log.debug(`getting keys for user: ${roleName}`);
985
988
  return requestCall(toptions, (error2, response2) => {
986
989
  if (error2) {
987
990
  return callback(null, error2);
988
991
  }
989
- const awsResponse = JSON.parse(response2.body);
990
- const accessKeyId = awsResponse.AccessKeyId;
991
- const secretAccessKey = awsResponse.SecretAccessKey;
992
- const sessionToken = awsResponse.Token;
993
- const authOpts = aws4.sign(options, { accessKeyId, secretAccessKey });
994
- if (sessionToken) {
995
- authOpts.headers['X-Amz-Security-Token'] = sessionToken;
992
+ if (!response2 || !response2.body) {
993
+ return callback(null, 'No Authentication Keys');
994
+ }
995
+ try {
996
+ const awsResponse = JSON.parse(response2.body);
997
+ const accessKeyId = awsResponse.AccessKeyId;
998
+ const secretAccessKey = awsResponse.SecretAccessKey;
999
+ const sessionToken = awsResponse.Token;
1000
+ log.debug(`getting call signature with credntials for user: ${roleName}`);
1001
+ const authOpts = aws4.sign(options, { accessKeyId, secretAccessKey });
1002
+ if (sessionToken) {
1003
+ authOpts.headers['X-Amz-Security-Token'] = sessionToken;
1004
+ }
1005
+ // return the headers
1006
+ return callback(authOpts.headers);
1007
+ } catch (e) {
1008
+ return callback(null, e);
996
1009
  }
997
- // return the headers
998
- return callback(authOpts.headers);
999
1010
  });
1000
1011
  });
1001
1012
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-amazon_route53",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "This adapter integrates with system described as: Amazon Route53.",
5
5
  "main": "adapter.js",
6
6
  "systemName": "Amazon Route53",
Binary file