@itentialopensource/adapter-gcp_compute 1.5.1 → 1.6.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/CALLS.md +3383 -0
- package/CHANGELOG.md +16 -0
- package/adapter.js +21 -8
- package/metadata.json +9 -2
- package/package.json +3 -3
- package/propertiesSchema.json +10 -1
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +4 -4
- package/report/updateReport1698420667915.json +120 -0
- package/utils/methodDocumentor.js +16 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## 1.6.0 [11-06-2023]
|
|
3
|
+
|
|
4
|
+
* More migration changes
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/cloud/adapter-gcp_compute!13
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1.5.2 [09-18-2023]
|
|
11
|
+
|
|
12
|
+
* Patch/adapt 2852
|
|
13
|
+
|
|
14
|
+
See merge request itentialopensource/adapters/cloud/adapter-gcp_compute!12
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
2
18
|
## 1.5.1 [09-11-2023]
|
|
3
19
|
|
|
4
20
|
* more migration & metadata changes
|
package/adapter.js
CHANGED
|
@@ -134,7 +134,8 @@ class GcpCompute extends AdapterBaseCl {
|
|
|
134
134
|
'refreshAuthorizationHeader',
|
|
135
135
|
'refreshAuthorizationAndIdentifyRequest',
|
|
136
136
|
'getToken',
|
|
137
|
-
'generateKeyObjFromProps'
|
|
137
|
+
'generateKeyObjFromProps',
|
|
138
|
+
'refreshAuthorizationBroker'
|
|
138
139
|
];
|
|
139
140
|
if (!inIgnore && Array.isArray(inIgnore)) {
|
|
140
141
|
myIgnore = inIgnore;
|
|
@@ -442,7 +443,7 @@ class GcpCompute extends AdapterBaseCl {
|
|
|
442
443
|
log.trace(origin);
|
|
443
444
|
|
|
444
445
|
try {
|
|
445
|
-
return super.hasEntities(entityType, entityList, callback);
|
|
446
|
+
return this.refreshAuthorizationBroker().then(() => super.hasEntities(entityType, entityList, callback));
|
|
446
447
|
} catch (err) {
|
|
447
448
|
log.error(`${origin}: ${err}`);
|
|
448
449
|
return callback(null, err);
|
|
@@ -464,7 +465,7 @@ class GcpCompute extends AdapterBaseCl {
|
|
|
464
465
|
log.trace(origin);
|
|
465
466
|
|
|
466
467
|
try {
|
|
467
|
-
return super.getDevice(deviceName, callback);
|
|
468
|
+
return this.refreshAuthorizationBroker().then(() => super.getDevice(deviceName, callback));
|
|
468
469
|
} catch (err) {
|
|
469
470
|
log.error(`${origin}: ${err}`);
|
|
470
471
|
return callback(null, err);
|
|
@@ -484,9 +485,8 @@ class GcpCompute extends AdapterBaseCl {
|
|
|
484
485
|
const meth = 'adapter-getDevicesFiltered';
|
|
485
486
|
const origin = `${this.id}-${meth}`;
|
|
486
487
|
log.trace(origin);
|
|
487
|
-
|
|
488
488
|
try {
|
|
489
|
-
return super.getDevicesFiltered(options, callback);
|
|
489
|
+
return this.refreshAuthorizationBroker().then(() => super.getDevicesFiltered(options, callback));
|
|
490
490
|
} catch (err) {
|
|
491
491
|
log.error(`${origin}: ${err}`);
|
|
492
492
|
return callback(null, err);
|
|
@@ -508,7 +508,7 @@ class GcpCompute extends AdapterBaseCl {
|
|
|
508
508
|
log.trace(origin);
|
|
509
509
|
|
|
510
510
|
try {
|
|
511
|
-
return super.isAlive(deviceName, callback);
|
|
511
|
+
return this.refreshAuthorizationBroker().then(() => super.isAlive(deviceName, callback));
|
|
512
512
|
} catch (err) {
|
|
513
513
|
log.error(`${origin}: ${err}`);
|
|
514
514
|
return callback(null, err);
|
|
@@ -531,7 +531,7 @@ class GcpCompute extends AdapterBaseCl {
|
|
|
531
531
|
log.trace(origin);
|
|
532
532
|
|
|
533
533
|
try {
|
|
534
|
-
return super.getConfig(deviceName, format, callback);
|
|
534
|
+
return this.refreshAuthorizationBroker().then(() => super.getConfig(deviceName, format, callback));
|
|
535
535
|
} catch (err) {
|
|
536
536
|
log.error(`${origin}: ${err}`);
|
|
537
537
|
return callback(null, err);
|
|
@@ -552,7 +552,7 @@ class GcpCompute extends AdapterBaseCl {
|
|
|
552
552
|
log.trace(origin);
|
|
553
553
|
|
|
554
554
|
try {
|
|
555
|
-
return super.iapGetDeviceCount(callback);
|
|
555
|
+
return this.refreshAuthorizationBroker().then(() => super.iapGetDeviceCount(callback));
|
|
556
556
|
} catch (err) {
|
|
557
557
|
log.error(`${origin}: ${err}`);
|
|
558
558
|
return callback(null, err);
|
|
@@ -845,6 +845,19 @@ class GcpCompute extends AdapterBaseCl {
|
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
|
|
848
|
+
async refreshAuthorizationBroker() {
|
|
849
|
+
const meth = 'adapter-refreshAuthorizationBroker';
|
|
850
|
+
const origin = `${this.id}-${meth}`;
|
|
851
|
+
try {
|
|
852
|
+
const token = await this.gtoken.getToken();
|
|
853
|
+
this.refreshAuthorizationHeader(token);
|
|
854
|
+
} catch (ex) {
|
|
855
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
856
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString} ${ex.message}`);
|
|
857
|
+
throw new Error(errorObj);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
|
|
848
861
|
/**
|
|
849
862
|
* configureGtoken accepts the options for the gtoken library documented in the website below,
|
|
850
863
|
* plus keyFileContents in order to facilitate convenient retrieval from Hashicorp Vault
|
package/metadata.json
CHANGED
|
@@ -23,7 +23,14 @@
|
|
|
23
23
|
"Virtual Compute"
|
|
24
24
|
],
|
|
25
25
|
"useCases": [
|
|
26
|
-
"
|
|
26
|
+
"Add or remove Virtual Machine Images",
|
|
27
|
+
"Instantiate, manage, remove Virtual Machine Instances",
|
|
28
|
+
"Deploy Virtual Services and Functions",
|
|
29
|
+
"Determine available Cloud Resources",
|
|
30
|
+
"Assign resources to Virtual Machine Instances",
|
|
31
|
+
"Add or remove Virtual Networks",
|
|
32
|
+
"Management of Cloud Network Assignments",
|
|
33
|
+
"Management of Cloud Storage"
|
|
27
34
|
],
|
|
28
35
|
"deprecated": {
|
|
29
36
|
"isDeprecated": false
|
|
@@ -35,7 +42,7 @@
|
|
|
35
42
|
"repoLink": "https://gitlab.com/itentialopensource/adapters/cloud/adapter-gcp_compute",
|
|
36
43
|
"docLink": "https://docs.itential.com/opensource/docs/google-cloud-compute",
|
|
37
44
|
"demoLinks": [
|
|
38
|
-
"https://www.itential.com/automations/sd-wan-branch-management",
|
|
45
|
+
"https://www.itential.com/automations/sd-wan-branch-management/",
|
|
39
46
|
"https://www.itential.com/solutions/sdwan-automation-orchestration/"
|
|
40
47
|
],
|
|
41
48
|
"faqLink": "https://docs.itential.com/opensource/docs/troubleshooting-an-adapter",
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-gcp_compute",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "This adapter integrates with system described as: computeEngineApi.",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"systemName": "Google Cloud Platform Compute",
|
|
7
7
|
"wizardVersion": "2.44.7",
|
|
8
|
-
"engineVersion": "1.67.
|
|
8
|
+
"engineVersion": "1.67.10",
|
|
9
9
|
"adapterType": "http",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"artifactize": "npm i && node utils/packModificationScript.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"author": "Itential",
|
|
57
57
|
"homepage": "https://gitlab.com/itentialopensource/adapters/cloud/adapter-gcp_compute#readme",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@itentialopensource/adapter-utils": "^5.
|
|
59
|
+
"@itentialopensource/adapter-utils": "^5.3.0",
|
|
60
60
|
"acorn": "^8.10.0",
|
|
61
61
|
"ajv": "^8.12.0",
|
|
62
62
|
"axios": "^1.4.0",
|
package/propertiesSchema.json
CHANGED
|
@@ -109,6 +109,14 @@
|
|
|
109
109
|
},
|
|
110
110
|
"cache": {
|
|
111
111
|
"$ref": "#/definitions/cache"
|
|
112
|
+
},
|
|
113
|
+
"service": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"description": "Service we are integrating with -- used with AWS Authentication",
|
|
116
|
+
"examples": [
|
|
117
|
+
"ec2",
|
|
118
|
+
"route53"
|
|
119
|
+
]
|
|
112
120
|
}
|
|
113
121
|
},
|
|
114
122
|
"required": [
|
|
@@ -131,7 +139,8 @@
|
|
|
131
139
|
"jwt_token",
|
|
132
140
|
"request_token",
|
|
133
141
|
"no_authentication",
|
|
134
|
-
"multi_step_authentication"
|
|
142
|
+
"multi_step_authentication",
|
|
143
|
+
"aws_authentication"
|
|
135
144
|
]
|
|
136
145
|
},
|
|
137
146
|
"username": {
|
|
Binary file
|
package/report/adapterInfo.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.5.
|
|
3
|
-
"configLines":
|
|
2
|
+
"version": "1.5.2",
|
|
3
|
+
"configLines": 77493,
|
|
4
4
|
"scriptLines": 1783,
|
|
5
|
-
"codeLines":
|
|
5
|
+
"codeLines": 57391,
|
|
6
6
|
"testLines": 61729,
|
|
7
7
|
"testCases": 2510,
|
|
8
|
-
"totalCodeLines":
|
|
8
|
+
"totalCodeLines": 120903,
|
|
9
9
|
"wfTasks": 583
|
|
10
10
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [],
|
|
3
|
+
"statistics": [
|
|
4
|
+
{
|
|
5
|
+
"owner": "errorJson",
|
|
6
|
+
"description": "New adapter errors available for use",
|
|
7
|
+
"value": 0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"owner": "errorJson",
|
|
11
|
+
"description": "Adapter errors no longer available for use",
|
|
12
|
+
"value": 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"owner": "errorJson",
|
|
16
|
+
"description": "Adapter errors that have been updated (e.g. recommendation changes)",
|
|
17
|
+
"value": 31
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of production dependencies",
|
|
22
|
+
"value": 17
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Number of development dependencies",
|
|
27
|
+
"value": 6
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "packageJson",
|
|
31
|
+
"description": "Number of npm scripts",
|
|
32
|
+
"value": 22
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "packageJson",
|
|
36
|
+
"description": "Runtime Library dependency",
|
|
37
|
+
"value": "^5.3.0"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "propertiesSchemaJson",
|
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
42
|
+
"value": 78
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "markdown",
|
|
46
|
+
"description": "Number of lines in the README.md",
|
|
47
|
+
"value": 347
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "markdown",
|
|
51
|
+
"description": "Number of lines in the SUMMARY.md",
|
|
52
|
+
"value": 9
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "markdown",
|
|
56
|
+
"description": "Number of lines in the PROPERTIES.md",
|
|
57
|
+
"value": 642
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "markdown",
|
|
61
|
+
"description": "Number of lines in the TROUBLESHOOT.md",
|
|
62
|
+
"value": 48
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "markdown",
|
|
66
|
+
"description": "Number of lines in the ENHANCE.md",
|
|
67
|
+
"value": 70
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "markdown",
|
|
71
|
+
"description": "Number of lines in the BROKER.md",
|
|
72
|
+
"value": 70
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "unitTestJS",
|
|
76
|
+
"description": "Number of lines of code in unit tests",
|
|
77
|
+
"value": 29172
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "unitTestJS",
|
|
81
|
+
"description": "Number of unit tests",
|
|
82
|
+
"value": 1865
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "integrationTestJS",
|
|
86
|
+
"description": "Number of lines of code in integration tests",
|
|
87
|
+
"value": 31305
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "integrationTestJS",
|
|
91
|
+
"description": "Number of integration tests",
|
|
92
|
+
"value": 567
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"owner": "staticFile",
|
|
96
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
97
|
+
"value": 1453
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"owner": "staticFile",
|
|
101
|
+
"description": "Number of static files added",
|
|
102
|
+
"value": 36
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"owner": "Overall",
|
|
106
|
+
"description": "Total lines of Code",
|
|
107
|
+
"value": 61930
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"owner": "Overall",
|
|
111
|
+
"description": "Total Tests",
|
|
112
|
+
"value": 2432
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"owner": "Overall",
|
|
116
|
+
"description": "Total Files",
|
|
117
|
+
"value": 6
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
@@ -77,6 +77,7 @@ function readFileUsingLib(filename, descriptionObj, workflowObj, functionList) {
|
|
|
77
77
|
// parsing the file to get the function and class declarations.
|
|
78
78
|
const aFileFuncArgs = acorn.parse(aFile, { ecmaVersion: 2020 });
|
|
79
79
|
|
|
80
|
+
let callName = 'identifyRequest';
|
|
80
81
|
// Looping through all the declarations parsed:
|
|
81
82
|
aFileFuncArgs.body.forEach((e) => {
|
|
82
83
|
// Getting only the class declaration as it has our required functions.
|
|
@@ -89,8 +90,10 @@ function readFileUsingLib(filename, descriptionObj, workflowObj, functionList) {
|
|
|
89
90
|
method.value.params.forEach((param) => {
|
|
90
91
|
if (param.type === 'Identifier') {
|
|
91
92
|
funcArgs.push(param.name);
|
|
93
|
+
} else if (param.type === 'RestElement') {
|
|
94
|
+
funcArgs.push(`...${param.argument.name}`);
|
|
92
95
|
} else {
|
|
93
|
-
const args = `${param.left.name} = ${param.right.
|
|
96
|
+
const args = `${param.left.name} = ${param.right.raw}`;
|
|
94
97
|
funcArgs.push(args);
|
|
95
98
|
}
|
|
96
99
|
});
|
|
@@ -102,7 +105,7 @@ function readFileUsingLib(filename, descriptionObj, workflowObj, functionList) {
|
|
|
102
105
|
});
|
|
103
106
|
const requests = [];
|
|
104
107
|
for (let i = 0; i < callList.length; i += 1) {
|
|
105
|
-
if (callList[i].callee.property && callList[i].callee.property.name ===
|
|
108
|
+
if (callList[i].callee.property && callList[i].callee.property.name === callName) {
|
|
106
109
|
requests.push(callList[i]);
|
|
107
110
|
}
|
|
108
111
|
}
|
|
@@ -114,7 +117,16 @@ function readFileUsingLib(filename, descriptionObj, workflowObj, functionList) {
|
|
|
114
117
|
const entity = expr.arguments[0].value;
|
|
115
118
|
const actionName = expr.arguments[1].value;
|
|
116
119
|
if (expr !== undefined && (expr.arguments[0].type !== 'Literal' || expr.arguments[1].type !== 'Literal')) {
|
|
117
|
-
|
|
120
|
+
const param1 = method.value.params[0];
|
|
121
|
+
const param2 = method.value.params[1];
|
|
122
|
+
if (param1.type !== 'Identifier' || param2.type !== 'Identifier'
|
|
123
|
+
|| expr.arguments[0].type !== 'Identifier' || expr.arguments[1].type !== 'Identifier'
|
|
124
|
+
|| param1.name !== expr.arguments[0].name || param2.name !== expr.arguments[1].name) {
|
|
125
|
+
throw new Error(`identifyRequest proxy method ${funcName} unknown format`);
|
|
126
|
+
} else if (callName !== 'identifyRequest') {
|
|
127
|
+
throw new Error(`MethodDocumentor not yet programmed to handle multiple helper methods: 1) ${callName}, 2) ${funcName}`);
|
|
128
|
+
}
|
|
129
|
+
callName = funcName;
|
|
118
130
|
}
|
|
119
131
|
const entityPath = getPathFromEntity(entity, actionName);
|
|
120
132
|
|
|
@@ -197,6 +209,7 @@ function readMDFile(filename, functionList) {
|
|
|
197
209
|
// Creating the tags for each method to be appended to the file.
|
|
198
210
|
const tdBeginTag = ' <td style="padding:15px">';
|
|
199
211
|
const tdEndTag = '</td>';
|
|
212
|
+
|
|
200
213
|
functionList.forEach((func) => {
|
|
201
214
|
const signCommand = `${tdBeginTag}${func.method_signature}${tdEndTag}`;
|
|
202
215
|
const descCommand = `${tdBeginTag}${func.description}${tdEndTag}`;
|