@itentialopensource/adapter-google_drive 0.4.2 → 0.5.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/TAB2.md ADDED
@@ -0,0 +1,347 @@
1
+ # Google Drive
2
+
3
+ ## Table of Contents
4
+
5
+ - [Specific Adapter Information](#specific-adapter-information)
6
+ - [Authentication](#authentication)
7
+ - [Sample Properties](#sample-properties)
8
+ - [Swagger](#swagger)
9
+ - [Generic Adapter Information](#generic-adapter-information)
10
+
11
+ ## Specific Adapter Information
12
+ ### Authentication
13
+
14
+ This document will go through the steps for authenticating the Google Drive adapter with Google Token Security. Properly configuring the properties for an adapter in IAP is critical for getting the adapter online. You can read more about adapter authentication <a href="https://docs.itential.com/opensource/docs/authentication" target="_blank">HERE</a>.
15
+
16
+ Companies periodically change authentication methods to provide better security. As this happens this section should be updated and contributed/merge back into the adapter repository.
17
+
18
+ #### Google Token Authentication
19
+ The Google Drive adapter authenticates with Google Token Authentication. You must provide
20
+
21
+ STEPS
22
+ 1. Ensure you have access to a Google Drive server and that it is running
23
+ 2. Follow the steps in the README.md to import the adapter into IAP if you have not already done so
24
+ 3. Use the properties below for the ```properties.authentication``` field
25
+
26
+ ```json
27
+ "authentication": {
28
+ "auth_method": "no_authentication",
29
+ "service_account": {
30
+ "type": "service_account",
31
+ "project_id": "",
32
+ "private_key_id": "",
33
+ "scopes": [
34
+ "https://www.googleapis.com/auth/drive",
35
+ "https://www.googleapis.com/auth/drive.file"
36
+ ],
37
+ "private_key": "-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----\n",
38
+ "client_email": "",
39
+ "client_id": "",
40
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
41
+ "token_uri": "https://oauth2.googleapis.com/token",
42
+ "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
43
+ "client_x509_cert_url": ""
44
+ }
45
+ }
46
+ ```
47
+
48
+ you can leave all of the other properties in the authentication section, they will not be used for Google Drive Google token authentication.
49
+ 4. Restart the adapter. If your properties were set correctly, the adapter should go online.
50
+
51
+ #### Troubleshooting
52
+ - Make sure you copied over the correct Googgle properties as these are used to retrieve the token.
53
+ - Turn on debug level logs for the adapter in IAP Admin Essentials.
54
+ - Turn on auth_logging for the adapter in IAP Admin Essentials (adapter properties).
55
+ - Investigate the logs - in particular:
56
+ - The FULL REQUEST log to make sure the proper headers are being sent with the request.
57
+ - The FULL BODY log to make sure the payload is accurate.
58
+ - The CALL RETURN log to see what the other system is telling us.
59
+ - Credentials should be ** masked ** by the adapter so make sure you verify the username and password - including that there are erroneous spaces at the front or end.
60
+ - Remember when you are done to turn auth_logging off as you do not want to log credentials.
61
+
62
+ ### Sample Properties
63
+
64
+ Sample Properties can be used to help you configure the adapter in the Itential Automation Platform. You will need to update connectivity information such as the host, port, protocol and credentials.
65
+
66
+ ```json
67
+ "properties": {
68
+ "host": "www.googleapis.com",
69
+ "port": 443,
70
+ "choosepath": "",
71
+ "base_path": "/drive/v3",
72
+ "version": "",
73
+ "cache_location": "none",
74
+ "encode_pathvars": true,
75
+ "encode_queryvars": true,
76
+ "save_metric": false,
77
+ "stub": false,
78
+ "protocol": "https",
79
+ "authentication": {
80
+ "auth_method": "no_authentication",
81
+ "username": "username",
82
+ "password": "password",
83
+ "token": "",
84
+ "token_timeout": 600000,
85
+ "token_cache": "local",
86
+ "invalid_token_error": 401,
87
+ "auth_field": "header.headers.Authorization",
88
+ "auth_field_format": "Bearer {token}",
89
+ "auth_logging": false,
90
+ "client_id": "",
91
+ "client_secret": "",
92
+ "grant_type": "",
93
+ "sensitive": [],
94
+ "sso": {
95
+ "protocol": "",
96
+ "host": "",
97
+ "port": 0
98
+ },
99
+ "multiStepAuthCalls": [
100
+ {
101
+ "name": "",
102
+ "requestFields": {},
103
+ "responseFields": {},
104
+ "successfullResponseCode": 200
105
+ }
106
+ ],
107
+ "service_account": {
108
+ "type": "service_account",
109
+ "project_id": "",
110
+ "private_key_id": "",
111
+ "scopes": [
112
+ "https://www.googleapis.com/auth/drive",
113
+ "https://www.googleapis.com/auth/drive.file"
114
+ ],
115
+ "private_key": "-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----\n",
116
+ "client_email": "",
117
+ "client_id": "",
118
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
119
+ "token_uri": "https://oauth2.googleapis.com/token",
120
+ "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
121
+ "client_x509_cert_url": ""
122
+ }
123
+ },
124
+ "healthcheck": {
125
+ "type": "intermittent",
126
+ "frequency": 600000,
127
+ "query_object": {},
128
+ "addlHeaders": {}
129
+ },
130
+ "throttle": {
131
+ "throttle_enabled": false,
132
+ "number_pronghorns": 1,
133
+ "sync_async": "sync",
134
+ "max_in_queue": 1000,
135
+ "concurrent_max": 1,
136
+ "expire_timeout": 0,
137
+ "avg_runtime": 200,
138
+ "priorities": [
139
+ {
140
+ "value": 0,
141
+ "percent": 100
142
+ }
143
+ ]
144
+ },
145
+ "request": {
146
+ "number_redirects": 0,
147
+ "number_retries": 3,
148
+ "limit_retry_error": [
149
+ 0
150
+ ],
151
+ "failover_codes": [],
152
+ "attempt_timeout": 5000,
153
+ "global_request": {
154
+ "payload": {},
155
+ "uriOptions": {},
156
+ "addlHeaders": {},
157
+ "authData": {}
158
+ },
159
+ "healthcheck_on_timeout": true,
160
+ "return_raw": false,
161
+ "archiving": false,
162
+ "return_request": false
163
+ },
164
+ "proxy": {
165
+ "enabled": false,
166
+ "host": "",
167
+ "port": 1,
168
+ "protocol": "http",
169
+ "username": "",
170
+ "password": ""
171
+ },
172
+ "ssl": {
173
+ "ecdhCurve": "",
174
+ "enabled": false,
175
+ "accept_invalid_cert": false,
176
+ "ca_file": "",
177
+ "key_file": "",
178
+ "cert_file": "",
179
+ "secure_protocol": "",
180
+ "ciphers": ""
181
+ },
182
+ "mongo": {
183
+ "host": "",
184
+ "port": 0,
185
+ "database": "",
186
+ "username": "",
187
+ "password": "",
188
+ "replSet": "",
189
+ "db_ssl": {
190
+ "enabled": false,
191
+ "accept_invalid_cert": false,
192
+ "ca_file": "",
193
+ "key_file": "",
194
+ "cert_file": ""
195
+ }
196
+ },
197
+ "devicebroker": {
198
+ "enabled": false,
199
+ "getDevice": [
200
+ {
201
+ "path": "/not/mapped",
202
+ "method": "GET",
203
+ "query": {},
204
+ "body": {},
205
+ "headers": {},
206
+ "handleFailure": "ignore",
207
+ "requestFields": {
208
+ "insample": "{port}"
209
+ },
210
+ "responseDatakey": "",
211
+ "responseFields": {
212
+ "name": "{this}{||}{that}",
213
+ "ostype": "{osfield}",
214
+ "ostypePrefix": "meraki-",
215
+ "port": "{port}",
216
+ "ipaddress": "{ip_addr}",
217
+ "serial": "{serial}"
218
+ }
219
+ }
220
+ ],
221
+ "getDevicesFiltered": [
222
+ {
223
+ "path": "/not/mapped",
224
+ "method": "GET",
225
+ "pagination": {
226
+ "offsetVar": "",
227
+ "limitVar": "",
228
+ "incrementBy": "limit",
229
+ "requestLocation": "query"
230
+ },
231
+ "query": {},
232
+ "body": {},
233
+ "headers": {},
234
+ "handleFailure": "ignore",
235
+ "requestFields": {},
236
+ "responseDatakey": "",
237
+ "responseFields": {
238
+ "name": "{this}{||}{that}",
239
+ "ostype": "{osfield}",
240
+ "ostypePrefix": "meraki-",
241
+ "port": "{port}",
242
+ "ipaddress": "{ip_addr}",
243
+ "serial": "{serial}",
244
+ "id": "{myid}"
245
+ }
246
+ }
247
+ ],
248
+ "isAlive": [
249
+ {
250
+ "path": "/not/mapped/{devID}",
251
+ "method": "GET",
252
+ "query": {},
253
+ "body": {},
254
+ "headers": {},
255
+ "handleFailure": "ignore",
256
+ "requestFields": {
257
+ "devID": "{id}"
258
+ },
259
+ "responseDatakey": "",
260
+ "responseFields": {
261
+ "status": "return2xx",
262
+ "statusValue": "AD.200"
263
+ }
264
+ }
265
+ ],
266
+ "getConfig": [
267
+ {
268
+ "path": "/not/mapped/{devID}",
269
+ "method": "GET",
270
+ "query": {},
271
+ "body": {},
272
+ "headers": {},
273
+ "handleFailure": "ignore",
274
+ "requestFields": {
275
+ "devID": "{id}"
276
+ },
277
+ "responseDatakey": "",
278
+ "responseFields": {}
279
+ }
280
+ ],
281
+ "getCount": [
282
+ {
283
+ "path": "/not/mapped",
284
+ "method": "GET",
285
+ "query": {},
286
+ "body": {},
287
+ "headers": {},
288
+ "handleFailure": "ignore",
289
+ "requestFields": {},
290
+ "responseDatakey": "",
291
+ "responseFields": {}
292
+ }
293
+ ]
294
+ },
295
+ "cache": {
296
+ "enabled": false,
297
+ "entities": [
298
+ {
299
+ "entityType": "device",
300
+ "frequency": 3600,
301
+ "flushOnFail": false,
302
+ "limit": 10000,
303
+ "retryAttempts": 5,
304
+ "sort": true,
305
+ "populate": [
306
+ {
307
+ "path": "/not/mapped",
308
+ "method": "GET",
309
+ "pagination": {
310
+ "offsetVar": "",
311
+ "limitVar": "",
312
+ "incrementBy": "limit",
313
+ "requestLocation": "query"
314
+ },
315
+ "query": {},
316
+ "body": {},
317
+ "headers": {},
318
+ "handleFailure": "ignore",
319
+ "requestFields": {},
320
+ "responseDatakey": "",
321
+ "responseFields": {
322
+ "name": "{this}{||}{that}",
323
+ "ostype": "{osfield}",
324
+ "ostypePrefix": "meraki-",
325
+ "port": "{port}",
326
+ "ipaddress": "{ip_addr}",
327
+ "serial": "{serial}",
328
+ "id": "{myid}"
329
+ }
330
+ }
331
+ ],
332
+ "cachedTasks": [
333
+ {
334
+ "name": "",
335
+ "filterField": "",
336
+ "filterLoc": ""
337
+ }
338
+ ]
339
+ }
340
+ ]
341
+ }
342
+ }
343
+ ```
344
+ ### [Swagger](https://gitlab.com/itentialopensource/adapters/persistence/adapter-google_drive/-/blob/master/report/adapter-openapi.json)
345
+
346
+ ## [Generic Adapter Information](https://gitlab.com/itentialopensource/adapters/persistence/adapter-google_drive/-/blob/master/README.md)
347
+
package/metadata.json CHANGED
@@ -27,20 +27,37 @@
27
27
  "isDeprecated": false
28
28
  },
29
29
  "brokerSince": "",
30
+ "authMethods": [
31
+ {
32
+ "type": "Google Token",
33
+ "primary": true
34
+ }
35
+ ],
30
36
  "documentation": {
31
37
  "storeLink": "",
32
38
  "npmLink": "https://www.npmjs.com/package/@itentialopensource/adapter-google_drive",
33
- "repoLink": "https://gitlab.com/itentialopensource/adapters/persistence/adapter-google_drive",
39
+ "repoLink": "https://gitlab.com/itentialopensource/adapters/adapter-google_drive",
34
40
  "docLink": "https://docs.itential.com/opensource/docs/google-drive",
35
41
  "demoLinks": [],
36
- "trainingLinks": [],
42
+ "trainingLinks": [
43
+ {
44
+ "title": "Itential Academy",
45
+ "link": "https://www.itential.com/itential-academy/"
46
+ }
47
+ ],
37
48
  "faqLink": "https://docs.itential.com/opensource/docs/troubleshooting-an-adapter",
38
49
  "contributeLink": "https://gitlab.com/itentialopensource/adapters/contributing-guide",
39
50
  "issueLink": "https://itential.atlassian.net/servicedesk/customer/portals",
40
51
  "webLink": "https://www.itential.com/adapters/google-drive/",
41
- "vendorLink": "",
42
- "productLink": "",
43
- "apiLinks": []
52
+ "vendorLink": "https://www.google.com/",
53
+ "productLink": "https://www.google.com/drive/",
54
+ "apiLinks": [
55
+ {
56
+ "title": "Google Drive API overview",
57
+ "link": "https://developers.google.com/drive/api/reference/rest/v3",
58
+ "public": true
59
+ }
60
+ ]
44
61
  },
45
62
  "assets": [],
46
63
  "relatedItems": {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-google_drive",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "This adapter integrates with system described as: google drive",
5
5
  "main": "adapter.js",
6
6
  "wizardVersion": "2.44.7",
7
- "engineVersion": "1.67.14",
7
+ "engineVersion": "1.67.20",
8
8
  "adapterType": "http",
9
9
  "scripts": {
10
10
  "artifactize": "npm i && node utils/packModificationScript.js",
@@ -15,7 +15,6 @@
15
15
  "test:baseunit": "mocha test/unit/adapterBaseTestUnit.js --LOG=error",
16
16
  "test:unit": "mocha test/unit/adapterTestUnit.js --LOG=error",
17
17
  "test:integration": "mocha test/integration/adapterTestIntegration.js --LOG=error",
18
- "test:cover": "nyc --reporter html --reporter text mocha --reporter dot test/*",
19
18
  "adapter:patches2bundled": "node utils/patches2bundledDeps.js",
20
19
  "test": "npm run test:baseunit && npm run test:unit && npm run test:integration",
21
20
  "adapter:install": "npm i && node utils/tbScript.js install",
@@ -45,20 +44,20 @@
45
44
  ],
46
45
  "license": "Apache-2.0",
47
46
  "engines": {
48
- "node": ">= 8.0.0",
47
+ "node": ">= 14.0.0",
49
48
  "npm": ">= 6.0.0"
50
49
  },
51
50
  "repository": {
52
51
  "type": "git",
53
- "url": "git@gitlab.com:itentialopensource/adapters/persistence/adapter-google_drive.git"
52
+ "url": "git@gitlab.com:itentialopensource/adapters/adapter-google_drive.git"
54
53
  },
55
54
  "author": "Itential",
56
- "homepage": "https://gitlab.com/itentialopensource/adapters/persistence/adapter-google_drive#readme",
55
+ "homepage": "https://gitlab.com/itentialopensource/adapters/adapter-google_drive#readme",
57
56
  "dependencies": {
58
- "@itentialopensource/adapter-utils": "^5.3.8",
57
+ "@itentialopensource/adapter-utils": "^5.5.0",
59
58
  "acorn": "^8.10.0",
60
59
  "ajv": "^8.12.0",
61
- "axios": "^1.6.7",
60
+ "axios": "^1.6.8",
62
61
  "commander": "^11.0.0",
63
62
  "dns-lookup-promise": "^1.0.4",
64
63
  "fs-extra": "^11.1.1",
@@ -67,7 +66,6 @@
67
66
  "mocha": "^10.3.0",
68
67
  "mocha-param": "^2.0.1",
69
68
  "mongodb": "^4.16.0",
70
- "nyc": "^15.1.0",
71
69
  "ping": "^0.4.4",
72
70
  "prompts": "^2.4.2",
73
71
  "readline-sync": "^1.4.10",
@@ -945,6 +945,11 @@
945
945
  "devicebroker": {
946
946
  "type": "object",
947
947
  "properties": {
948
+ "enabled": {
949
+ "type": "boolean",
950
+ "description": "Whether or not the device broker calls have been mapped",
951
+ "default": false
952
+ },
948
953
  "getDevice": {
949
954
  "type": "array",
950
955
  "description": "Broker call(s) to getDevice",
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.3.0",
3
- "configLines": 13243,
2
+ "version": "0.4.3",
3
+ "configLines": 13248,
4
4
  "scriptLines": 1783,
5
5
  "codeLines": 6688,
6
- "testLines": 6976,
6
+ "testLines": 6975,
7
7
  "testCases": 294,
8
- "totalCodeLines": 15447,
8
+ "totalCodeLines": 15446,
9
9
  "wfTasks": 71
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": 16
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": 21
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^5.5.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": 344
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": 647
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": 2994
78
+ },
79
+ {
80
+ "owner": "unitTestJS",
81
+ "description": "Number of unit tests",
82
+ "value": 169
83
+ },
84
+ {
85
+ "owner": "integrationTestJS",
86
+ "description": "Number of lines of code in integration tests",
87
+ "value": 2729
88
+ },
89
+ {
90
+ "owner": "integrationTestJS",
91
+ "description": "Number of integration tests",
92
+ "value": 55
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": 7176
108
+ },
109
+ {
110
+ "owner": "Overall",
111
+ "description": "Total Tests",
112
+ "value": 224
113
+ },
114
+ {
115
+ "owner": "Overall",
116
+ "description": "Total Files",
117
+ "value": 6
118
+ }
119
+ ]
120
+ }