comprodls-sdk 2.123.2-security → 2.123.4-oidc-poc.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/.eslintrc +28 -28
- package/.github/workflows/npm-publish.yml +76 -0
- package/README.md +235 -235
- package/dist/comprodls-sdk.js +13543 -13543
- package/docs/npm-oidc-publishing-runbook.md +229 -0
- package/lib/comprodls.js +132 -132
- package/lib/config/index.js +356 -356
- package/lib/helpers/index.js +31 -31
- package/lib/helpers/lib/api/converter.js +129 -129
- package/lib/helpers/lib/api/index.js +46 -46
- package/lib/helpers/lib/errors.js +122 -122
- package/lib/helpers/lib/requestLayer.js +154 -154
- package/lib/helpers/lib/validator.js +192 -192
- package/lib/open_access/index.js +116 -116
- package/lib/services/analytics/index.js +1365 -1365
- package/lib/services/attempts/index.js +389 -389
- package/lib/services/auth/index.js +3708 -3708
- package/lib/services/authextn/index.js +1032 -1032
- package/lib/services/datasyncmanager/index.js +275 -275
- package/lib/services/drive/index.js +270 -270
- package/lib/services/integrations/index.js +525 -525
- package/lib/services/invitations/index.js +282 -282
- package/lib/services/product/index.js +343 -343
- package/lib/services/pub/index.js +530 -530
- package/lib/services/pushX/index.js +251 -251
- package/lib/services/pushX/pubnubClientWrapper.js +438 -438
- package/lib/services/rules/index.js +416 -416
- package/lib/services/spaces/index.js +999 -999
- package/lib/services/spacesextn/index.js +131 -131
- package/lib/services/superuser/index.js +160 -160
- package/lib/services/taxonomy/index.js +405 -405
- package/lib/services/workflows/index.js +406 -406
- package/lib/services/xapi/index.js +114 -114
- package/lib/token/index.js +120 -120
- package/lib/token/validations.js +85 -85
- package/package.json +5 -1
|
@@ -1,275 +1,275 @@
|
|
|
1
|
-
/*************************************************************************
|
|
2
|
-
*
|
|
3
|
-
* COMPRO CONFIDENTIAL
|
|
4
|
-
* __________________
|
|
5
|
-
*
|
|
6
|
-
* [2015] - [2020] Compro Technologies Private Limited
|
|
7
|
-
* All Rights Reserved.
|
|
8
|
-
*
|
|
9
|
-
* NOTICE: All information contained herein is, and remains
|
|
10
|
-
* the property of Compro Technologies Private Limited. The
|
|
11
|
-
* intellectual and technical concepts contained herein are
|
|
12
|
-
* proprietary to Compro Technologies Private Limited and may
|
|
13
|
-
* be covered by U.S. and Foreign Patents, patents in process,
|
|
14
|
-
* and are protected by trade secret or copyright law.
|
|
15
|
-
*
|
|
16
|
-
* Dissemination of this information or reproduction of this material
|
|
17
|
-
* is strictly forbidden unless prior written permission is obtained
|
|
18
|
-
* from Compro Technologies Pvt. Ltd..
|
|
19
|
-
***************************************************************************/
|
|
20
|
-
|
|
21
|
-
/***********************************************************
|
|
22
|
-
* comproDLS SDK datasyncmanager Adaptor
|
|
23
|
-
* Functions for calling datasyncmanager APIs.
|
|
24
|
-
************************************************************/
|
|
25
|
-
|
|
26
|
-
var q = require('q');
|
|
27
|
-
var request = require('superagent');
|
|
28
|
-
var Agent = require('agentkeepalive');
|
|
29
|
-
|
|
30
|
-
var helpers = require('../../helpers');
|
|
31
|
-
var DLSError = helpers.errors.DLSError;
|
|
32
|
-
|
|
33
|
-
module.exports = datasyncmanager;
|
|
34
|
-
|
|
35
|
-
var keepaliveAgent = new Agent({
|
|
36
|
-
timeout: 60000,
|
|
37
|
-
freeSocketTimeout: 30000
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
function datasyncmanager(accountId) {
|
|
41
|
-
this.accountId = accountId;
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
createDataSyncManager: createDataSyncManager.bind(this),
|
|
45
|
-
updateDataSyncManager: updateDataSyncManager.bind(this),
|
|
46
|
-
deleteDataSyncManager: deleteDataSyncManager.bind(this),
|
|
47
|
-
getParticularDataSyncManager: getParticularDataSyncManager.bind(this),
|
|
48
|
-
getAllDataSyncManagersOfAGroup: getAllDataSyncManagersOfAGroup.bind(this)
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Wiki Link for SDK params
|
|
54
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#createdatasyncmanagerparams
|
|
55
|
-
*/
|
|
56
|
-
function createDataSyncManager(options) {
|
|
57
|
-
var self = this;
|
|
58
|
-
// Initializing promise
|
|
59
|
-
var dfd = q.defer();
|
|
60
|
-
|
|
61
|
-
if(options && options.body) {
|
|
62
|
-
// Passed all validations, Contruct API url
|
|
63
|
-
var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.createDataSyncManager;
|
|
64
|
-
url = helpers.api.constructAPIUrl(url, {
|
|
65
|
-
accountid: self.accountId
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
var requestAPI = request.post(url)
|
|
69
|
-
.set('Content-Type', 'application/json')
|
|
70
|
-
.set('Accept', 'application/json')
|
|
71
|
-
.send(options.body);
|
|
72
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
73
|
-
|
|
74
|
-
requestAPI
|
|
75
|
-
.agent(keepaliveAgent)
|
|
76
|
-
.end(function(error, response) {
|
|
77
|
-
if(error) {
|
|
78
|
-
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
79
|
-
dfd.reject(err);
|
|
80
|
-
}
|
|
81
|
-
else { dfd.resolve(response.body); }
|
|
82
|
-
});
|
|
83
|
-
} else {
|
|
84
|
-
var err = {};
|
|
85
|
-
err.message = err.description = 'Mandatory param - body ' +
|
|
86
|
-
'not found in request options.';
|
|
87
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
88
|
-
dfd.reject(err);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return dfd.promise;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Wiki Link for SDK params
|
|
96
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#updatedatasyncmanagerparams
|
|
97
|
-
*/
|
|
98
|
-
function updateDataSyncManager(options) {
|
|
99
|
-
// Initializing promise
|
|
100
|
-
var deferred = q.defer();
|
|
101
|
-
var self = this;
|
|
102
|
-
|
|
103
|
-
if (options && options.dsmid && options.body) {
|
|
104
|
-
// Passed all validations, Contruct API url
|
|
105
|
-
var adaptor = self.config.DEFAULT_HOSTS.AUTH,
|
|
106
|
-
apiPath = self.config.AUTH_API_URLS.dataSyncManager,
|
|
107
|
-
url = adaptor + apiPath;
|
|
108
|
-
|
|
109
|
-
url = helpers.api.constructAPIUrl(url, {
|
|
110
|
-
accountid: self.accountId, dsmid: options.dsmid
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
var params = options.body;
|
|
114
|
-
// Setup request with URL and Params
|
|
115
|
-
var requestAPI = request.put(url)
|
|
116
|
-
.set('Content-Type', 'application/json')
|
|
117
|
-
.set('Accept', 'application/json')
|
|
118
|
-
.send(params);
|
|
119
|
-
|
|
120
|
-
if (self.traceid) {
|
|
121
|
-
requestAPI.set('X-Amzn-Trace-Id', self.traceid);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
requestAPI
|
|
125
|
-
.agent(keepaliveAgent)
|
|
126
|
-
.end(function(error, response) {
|
|
127
|
-
if (error) {
|
|
128
|
-
error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
129
|
-
deferred.reject(error);
|
|
130
|
-
} else {
|
|
131
|
-
deferred.resolve(response.body);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
} else {
|
|
135
|
-
var error = {};
|
|
136
|
-
error.message = error.description = 'Mandatory params: dsmid, body not found in the request options.';
|
|
137
|
-
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
138
|
-
deferred.reject(error);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return deferred.promise;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Wiki Link for SDK params
|
|
146
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#deletedatasyncmanagerparams
|
|
147
|
-
*/
|
|
148
|
-
function deleteDataSyncManager(options) {
|
|
149
|
-
var self = this;
|
|
150
|
-
var dfd = q.defer();
|
|
151
|
-
|
|
152
|
-
if(options && options.dsmid && options.body) {
|
|
153
|
-
// Passed all validations, Contruct API url
|
|
154
|
-
var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.dataSyncManager;
|
|
155
|
-
url = helpers.api.constructAPIUrl(url, { accountid: self.accountId, dsmid: options.dsmid });
|
|
156
|
-
|
|
157
|
-
// Setup request with URL and Params
|
|
158
|
-
var requestAPI = request.delete(url)
|
|
159
|
-
.set('Content-Type', 'application/json')
|
|
160
|
-
.set('Accept', 'application/json')
|
|
161
|
-
.send(options.body);
|
|
162
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
163
|
-
|
|
164
|
-
requestAPI
|
|
165
|
-
.agent(keepaliveAgent)
|
|
166
|
-
.end(function (error, response) {
|
|
167
|
-
if(error) {
|
|
168
|
-
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
169
|
-
dfd.reject(err);
|
|
170
|
-
}
|
|
171
|
-
else { dfd.resolve(response.body); }
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
var err = {};
|
|
176
|
-
err.message = err.description = 'Mandatory params - dsmid or body' +
|
|
177
|
-
' not found in request options.';
|
|
178
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
179
|
-
dfd.reject(err);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return dfd.promise;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Wiki Link for SDK params
|
|
187
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#getparticulardatasyncmanagerparams
|
|
188
|
-
*/
|
|
189
|
-
function getParticularDataSyncManager(options) {
|
|
190
|
-
// Initializing promise
|
|
191
|
-
var deferred = q.defer();
|
|
192
|
-
var self = this;
|
|
193
|
-
|
|
194
|
-
if (options && options.dsmid) {
|
|
195
|
-
// Passed all validations, Contruct API url
|
|
196
|
-
var adaptor = self.config.DEFAULT_HOSTS.AUTH,
|
|
197
|
-
apiPath = self.config.AUTH_API_URLS.dataSyncManager,
|
|
198
|
-
url = adaptor + apiPath;
|
|
199
|
-
|
|
200
|
-
url = helpers.api.constructAPIUrl(url, {
|
|
201
|
-
accountid: self.accountId, dsmid: options.dsmid
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
// Setup request with URL and Params
|
|
205
|
-
var requestAPI = request.get(url);
|
|
206
|
-
|
|
207
|
-
if (self.traceid) {
|
|
208
|
-
requestAPI.set('X-Amzn-Trace-Id', self.traceid);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
requestAPI
|
|
212
|
-
.agent(keepaliveAgent)
|
|
213
|
-
.end(function(error, response) {
|
|
214
|
-
if (error) {
|
|
215
|
-
error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
216
|
-
deferred.reject(error);
|
|
217
|
-
} else {
|
|
218
|
-
deferred.resolve(response.body);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
} else {
|
|
222
|
-
var error = {};
|
|
223
|
-
error.message = error.description = 'Mandatory params: dsmid not found in request options.';
|
|
224
|
-
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
225
|
-
deferred.reject(error);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return deferred.promise;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Wiki Link for SDK params
|
|
233
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#getalldatasyncmanagersofagroupparams
|
|
234
|
-
*/
|
|
235
|
-
function getAllDataSyncManagersOfAGroup(options) {
|
|
236
|
-
// Initializing promise
|
|
237
|
-
var deferred = q.defer();
|
|
238
|
-
var self = this;
|
|
239
|
-
|
|
240
|
-
if (options && options.dsm_groupid) {
|
|
241
|
-
// Passed all validations, Contruct API url
|
|
242
|
-
var adaptor = self.config.DEFAULT_HOSTS.AUTH,
|
|
243
|
-
apiPath = self.config.AUTH_API_URLS.getAllDataSyncManagersOfAGroup,
|
|
244
|
-
url = adaptor + apiPath;
|
|
245
|
-
|
|
246
|
-
url = helpers.api.constructAPIUrl(url, {
|
|
247
|
-
accountid: self.accountId, dsm_groupid: options.dsm_groupid
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
// Setup request with URL and Params
|
|
251
|
-
var requestAPI = request.get(url);
|
|
252
|
-
|
|
253
|
-
if (self.traceid) {
|
|
254
|
-
requestAPI.set('X-Amzn-Trace-Id', self.traceid);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
requestAPI
|
|
258
|
-
.agent(keepaliveAgent)
|
|
259
|
-
.end(function(error, response) {
|
|
260
|
-
if (error) {
|
|
261
|
-
error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
262
|
-
deferred.reject(error);
|
|
263
|
-
} else {
|
|
264
|
-
deferred.resolve(response.body);
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
} else {
|
|
268
|
-
var error = {};
|
|
269
|
-
error.message = error.description = 'Mandatory params: dsm_groupid not found in request options.';
|
|
270
|
-
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
271
|
-
deferred.reject(error);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return deferred.promise;
|
|
275
|
-
}
|
|
1
|
+
/*************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* COMPRO CONFIDENTIAL
|
|
4
|
+
* __________________
|
|
5
|
+
*
|
|
6
|
+
* [2015] - [2020] Compro Technologies Private Limited
|
|
7
|
+
* All Rights Reserved.
|
|
8
|
+
*
|
|
9
|
+
* NOTICE: All information contained herein is, and remains
|
|
10
|
+
* the property of Compro Technologies Private Limited. The
|
|
11
|
+
* intellectual and technical concepts contained herein are
|
|
12
|
+
* proprietary to Compro Technologies Private Limited and may
|
|
13
|
+
* be covered by U.S. and Foreign Patents, patents in process,
|
|
14
|
+
* and are protected by trade secret or copyright law.
|
|
15
|
+
*
|
|
16
|
+
* Dissemination of this information or reproduction of this material
|
|
17
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
18
|
+
* from Compro Technologies Pvt. Ltd..
|
|
19
|
+
***************************************************************************/
|
|
20
|
+
|
|
21
|
+
/***********************************************************
|
|
22
|
+
* comproDLS SDK datasyncmanager Adaptor
|
|
23
|
+
* Functions for calling datasyncmanager APIs.
|
|
24
|
+
************************************************************/
|
|
25
|
+
|
|
26
|
+
var q = require('q');
|
|
27
|
+
var request = require('superagent');
|
|
28
|
+
var Agent = require('agentkeepalive');
|
|
29
|
+
|
|
30
|
+
var helpers = require('../../helpers');
|
|
31
|
+
var DLSError = helpers.errors.DLSError;
|
|
32
|
+
|
|
33
|
+
module.exports = datasyncmanager;
|
|
34
|
+
|
|
35
|
+
var keepaliveAgent = new Agent({
|
|
36
|
+
timeout: 60000,
|
|
37
|
+
freeSocketTimeout: 30000
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
function datasyncmanager(accountId) {
|
|
41
|
+
this.accountId = accountId;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
createDataSyncManager: createDataSyncManager.bind(this),
|
|
45
|
+
updateDataSyncManager: updateDataSyncManager.bind(this),
|
|
46
|
+
deleteDataSyncManager: deleteDataSyncManager.bind(this),
|
|
47
|
+
getParticularDataSyncManager: getParticularDataSyncManager.bind(this),
|
|
48
|
+
getAllDataSyncManagersOfAGroup: getAllDataSyncManagersOfAGroup.bind(this)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Wiki Link for SDK params
|
|
54
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#createdatasyncmanagerparams
|
|
55
|
+
*/
|
|
56
|
+
function createDataSyncManager(options) {
|
|
57
|
+
var self = this;
|
|
58
|
+
// Initializing promise
|
|
59
|
+
var dfd = q.defer();
|
|
60
|
+
|
|
61
|
+
if(options && options.body) {
|
|
62
|
+
// Passed all validations, Contruct API url
|
|
63
|
+
var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.createDataSyncManager;
|
|
64
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
65
|
+
accountid: self.accountId
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var requestAPI = request.post(url)
|
|
69
|
+
.set('Content-Type', 'application/json')
|
|
70
|
+
.set('Accept', 'application/json')
|
|
71
|
+
.send(options.body);
|
|
72
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
73
|
+
|
|
74
|
+
requestAPI
|
|
75
|
+
.agent(keepaliveAgent)
|
|
76
|
+
.end(function(error, response) {
|
|
77
|
+
if(error) {
|
|
78
|
+
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
79
|
+
dfd.reject(err);
|
|
80
|
+
}
|
|
81
|
+
else { dfd.resolve(response.body); }
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
var err = {};
|
|
85
|
+
err.message = err.description = 'Mandatory param - body ' +
|
|
86
|
+
'not found in request options.';
|
|
87
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
88
|
+
dfd.reject(err);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return dfd.promise;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Wiki Link for SDK params
|
|
96
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#updatedatasyncmanagerparams
|
|
97
|
+
*/
|
|
98
|
+
function updateDataSyncManager(options) {
|
|
99
|
+
// Initializing promise
|
|
100
|
+
var deferred = q.defer();
|
|
101
|
+
var self = this;
|
|
102
|
+
|
|
103
|
+
if (options && options.dsmid && options.body) {
|
|
104
|
+
// Passed all validations, Contruct API url
|
|
105
|
+
var adaptor = self.config.DEFAULT_HOSTS.AUTH,
|
|
106
|
+
apiPath = self.config.AUTH_API_URLS.dataSyncManager,
|
|
107
|
+
url = adaptor + apiPath;
|
|
108
|
+
|
|
109
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
110
|
+
accountid: self.accountId, dsmid: options.dsmid
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
var params = options.body;
|
|
114
|
+
// Setup request with URL and Params
|
|
115
|
+
var requestAPI = request.put(url)
|
|
116
|
+
.set('Content-Type', 'application/json')
|
|
117
|
+
.set('Accept', 'application/json')
|
|
118
|
+
.send(params);
|
|
119
|
+
|
|
120
|
+
if (self.traceid) {
|
|
121
|
+
requestAPI.set('X-Amzn-Trace-Id', self.traceid);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
requestAPI
|
|
125
|
+
.agent(keepaliveAgent)
|
|
126
|
+
.end(function(error, response) {
|
|
127
|
+
if (error) {
|
|
128
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
129
|
+
deferred.reject(error);
|
|
130
|
+
} else {
|
|
131
|
+
deferred.resolve(response.body);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
var error = {};
|
|
136
|
+
error.message = error.description = 'Mandatory params: dsmid, body not found in the request options.';
|
|
137
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
138
|
+
deferred.reject(error);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return deferred.promise;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Wiki Link for SDK params
|
|
146
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#deletedatasyncmanagerparams
|
|
147
|
+
*/
|
|
148
|
+
function deleteDataSyncManager(options) {
|
|
149
|
+
var self = this;
|
|
150
|
+
var dfd = q.defer();
|
|
151
|
+
|
|
152
|
+
if(options && options.dsmid && options.body) {
|
|
153
|
+
// Passed all validations, Contruct API url
|
|
154
|
+
var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.dataSyncManager;
|
|
155
|
+
url = helpers.api.constructAPIUrl(url, { accountid: self.accountId, dsmid: options.dsmid });
|
|
156
|
+
|
|
157
|
+
// Setup request with URL and Params
|
|
158
|
+
var requestAPI = request.delete(url)
|
|
159
|
+
.set('Content-Type', 'application/json')
|
|
160
|
+
.set('Accept', 'application/json')
|
|
161
|
+
.send(options.body);
|
|
162
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
163
|
+
|
|
164
|
+
requestAPI
|
|
165
|
+
.agent(keepaliveAgent)
|
|
166
|
+
.end(function (error, response) {
|
|
167
|
+
if(error) {
|
|
168
|
+
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
169
|
+
dfd.reject(err);
|
|
170
|
+
}
|
|
171
|
+
else { dfd.resolve(response.body); }
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
var err = {};
|
|
176
|
+
err.message = err.description = 'Mandatory params - dsmid or body' +
|
|
177
|
+
' not found in request options.';
|
|
178
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
179
|
+
dfd.reject(err);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return dfd.promise;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Wiki Link for SDK params
|
|
187
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#getparticulardatasyncmanagerparams
|
|
188
|
+
*/
|
|
189
|
+
function getParticularDataSyncManager(options) {
|
|
190
|
+
// Initializing promise
|
|
191
|
+
var deferred = q.defer();
|
|
192
|
+
var self = this;
|
|
193
|
+
|
|
194
|
+
if (options && options.dsmid) {
|
|
195
|
+
// Passed all validations, Contruct API url
|
|
196
|
+
var adaptor = self.config.DEFAULT_HOSTS.AUTH,
|
|
197
|
+
apiPath = self.config.AUTH_API_URLS.dataSyncManager,
|
|
198
|
+
url = adaptor + apiPath;
|
|
199
|
+
|
|
200
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
201
|
+
accountid: self.accountId, dsmid: options.dsmid
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Setup request with URL and Params
|
|
205
|
+
var requestAPI = request.get(url);
|
|
206
|
+
|
|
207
|
+
if (self.traceid) {
|
|
208
|
+
requestAPI.set('X-Amzn-Trace-Id', self.traceid);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
requestAPI
|
|
212
|
+
.agent(keepaliveAgent)
|
|
213
|
+
.end(function(error, response) {
|
|
214
|
+
if (error) {
|
|
215
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
216
|
+
deferred.reject(error);
|
|
217
|
+
} else {
|
|
218
|
+
deferred.resolve(response.body);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
} else {
|
|
222
|
+
var error = {};
|
|
223
|
+
error.message = error.description = 'Mandatory params: dsmid not found in request options.';
|
|
224
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
225
|
+
deferred.reject(error);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return deferred.promise;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Wiki Link for SDK params
|
|
233
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/27_DATASYNCMANAGER-Adapter#getalldatasyncmanagersofagroupparams
|
|
234
|
+
*/
|
|
235
|
+
function getAllDataSyncManagersOfAGroup(options) {
|
|
236
|
+
// Initializing promise
|
|
237
|
+
var deferred = q.defer();
|
|
238
|
+
var self = this;
|
|
239
|
+
|
|
240
|
+
if (options && options.dsm_groupid) {
|
|
241
|
+
// Passed all validations, Contruct API url
|
|
242
|
+
var adaptor = self.config.DEFAULT_HOSTS.AUTH,
|
|
243
|
+
apiPath = self.config.AUTH_API_URLS.getAllDataSyncManagersOfAGroup,
|
|
244
|
+
url = adaptor + apiPath;
|
|
245
|
+
|
|
246
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
247
|
+
accountid: self.accountId, dsm_groupid: options.dsm_groupid
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// Setup request with URL and Params
|
|
251
|
+
var requestAPI = request.get(url);
|
|
252
|
+
|
|
253
|
+
if (self.traceid) {
|
|
254
|
+
requestAPI.set('X-Amzn-Trace-Id', self.traceid);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
requestAPI
|
|
258
|
+
.agent(keepaliveAgent)
|
|
259
|
+
.end(function(error, response) {
|
|
260
|
+
if (error) {
|
|
261
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
262
|
+
deferred.reject(error);
|
|
263
|
+
} else {
|
|
264
|
+
deferred.resolve(response.body);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
} else {
|
|
268
|
+
var error = {};
|
|
269
|
+
error.message = error.description = 'Mandatory params: dsm_groupid not found in request options.';
|
|
270
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
271
|
+
deferred.reject(error);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return deferred.promise;
|
|
275
|
+
}
|