mongodb-atlas-api-client 2.32.0 → 3.0.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/.github/workflows/testcoverage.yml +46 -0
- package/README.md +79 -81
- package/package.json +6 -11
- package/src/alert.js +19 -16
- package/src/atlasSearch.js +43 -37
- package/src/atlasUser.js +31 -27
- package/src/cloudProviderAccess.js +26 -21
- package/src/cluster.js +49 -42
- package/src/customDbRole.js +31 -26
- package/src/dataLake.js +39 -37
- package/src/event.js +22 -20
- package/src/helper.js +11 -0
- package/src/httpClient.js +28 -0
- package/src/index.js +5 -6
- package/src/organization.js +41 -36
- package/src/project.js +46 -40
- package/src/projectAccesslist.js +31 -26
- package/src/projectWhitelist.js +31 -26
- package/src/user.js +31 -26
- package/test/alert.test.js +43 -0
- package/test/atlasSearch.test.js +91 -0
- package/test/dataLake.test.js +1 -2
- package/test/helper.test.js +38 -0
- package/.travis.yml +0 -6
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongodb-atlas-api-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A mongodb atlas api client for nodejs.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"cover": "istanbul cover ./node_modules/@hapi/lab/bin/lab ./test --leaks",
|
|
8
7
|
"pretest": "npm run depcheck && eslint --cache \"src/**/*.js\" \"test/**/*.js\"",
|
|
9
|
-
"depcheck": "depcheck
|
|
10
|
-
"
|
|
11
|
-
"test": "./node_modules/@hapi/lab/bin/lab ./test/ -v -S --assert @hapi/code --threshold 100 -p 1",
|
|
8
|
+
"depcheck": "depcheck",
|
|
9
|
+
"test": "./node_modules/@hapi/lab/bin/lab -I @@any-promise/REGISTRATION ./test/ -v -S --assert @hapi/code --threshold 100 -p 1 -o test-results/result.json -r json -r console -o stdout",
|
|
12
10
|
"lint": "./node_modules/.bin/eslint ./src --fix",
|
|
13
|
-
"travis": "npm run test",
|
|
14
11
|
"premajor": "npm run test",
|
|
15
12
|
"major": "npm version major -m \"published to npm as v%s\" && git push --follow-tags && npm publish",
|
|
16
13
|
"preminor": "npm run test",
|
|
@@ -41,14 +38,12 @@
|
|
|
41
38
|
"devDependencies": {
|
|
42
39
|
"@hapi/code": "^8.0.2",
|
|
43
40
|
"@hapi/lab": "^24.3.2",
|
|
44
|
-
"coveralls": "^3.1.1",
|
|
45
41
|
"depcheck": "^1.4.2",
|
|
46
42
|
"eslint": "^7.32.0",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
43
|
+
"nock": "^13.1.3",
|
|
44
|
+
"sinon": "^14.0.0"
|
|
49
45
|
},
|
|
50
46
|
"dependencies": {
|
|
51
|
-
"
|
|
52
|
-
"node-fetch": "^2.6.5"
|
|
47
|
+
"urllib": "^2.38.0"
|
|
53
48
|
}
|
|
54
49
|
}
|
package/src/alert.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class Alert {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl, projectId) {
|
|
@@ -6,34 +8,35 @@ class Alert {
|
|
|
6
8
|
this.projectId_ = projectId;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
async getAll(options) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
async getAll(options = {}) {
|
|
12
|
+
const queryString = getQueryStringFromOptions(options);
|
|
13
|
+
const httpOptions = options.httpOptions;
|
|
12
14
|
const response = (
|
|
13
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts?${queryString}
|
|
14
|
-
)
|
|
15
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts?${queryString}`, httpOptions)
|
|
16
|
+
);
|
|
15
17
|
return response;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
async get(alertId, options) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
async get(alertId, options = {}) {
|
|
21
|
+
const queryString = getQueryStringFromOptions(options);
|
|
22
|
+
const httpOptions = options.httpOptions;
|
|
21
23
|
const response = (
|
|
22
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts/${alertId}?${queryString}
|
|
23
|
-
)
|
|
24
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts/${alertId}?${queryString}`, httpOptions)
|
|
25
|
+
);
|
|
24
26
|
return response;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
async acknowledge(alertId, body, options) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
29
|
+
async acknowledge(alertId, body, options = {}) {
|
|
30
|
+
const queryString = getQueryStringFromOptions(options);
|
|
31
|
+
const httpOptions = options.httpOptions;
|
|
30
32
|
const response = (
|
|
31
33
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts/${alertId}?${queryString}`, {
|
|
32
34
|
"method": "PATCH",
|
|
33
|
-
"
|
|
34
|
-
"headers": {"Content-Type": "application/json"}
|
|
35
|
+
"data": body,
|
|
36
|
+
"headers": {"Content-Type": "application/json"},
|
|
37
|
+
...httpOptions
|
|
35
38
|
})
|
|
36
|
-
)
|
|
39
|
+
);
|
|
37
40
|
return response;
|
|
38
41
|
}
|
|
39
42
|
}
|
package/src/atlasSearch.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class AtlasSearch {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl, projectId) {
|
|
@@ -6,78 +8,82 @@ class AtlasSearch {
|
|
|
6
8
|
this.projectId_ = projectId;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
async get(clusterName, indexId, options) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
async get(clusterName, indexId, options = {}) {
|
|
12
|
+
const queryString = getQueryStringFromOptions(options);
|
|
13
|
+
const httpOptions = options.httpOptions;
|
|
12
14
|
const response = (
|
|
13
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}
|
|
14
|
-
)
|
|
15
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`, httpOptions)
|
|
16
|
+
);
|
|
15
17
|
return response;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
async getAllAnalyzers(clusterName, options) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
async getAllAnalyzers(clusterName, options = {}) {
|
|
21
|
+
const queryString = getQueryStringFromOptions(options);
|
|
22
|
+
const httpOptions = options.httpOptions;
|
|
21
23
|
const response = (
|
|
22
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/analyzers?${queryString}
|
|
23
|
-
)
|
|
24
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/analyzers?${queryString}`, httpOptions)
|
|
25
|
+
);
|
|
24
26
|
return response;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
async upsertAnalyzer(clusterName, body, options) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
29
|
+
async upsertAnalyzer(clusterName, body, options = {}) {
|
|
30
|
+
const queryString = getQueryStringFromOptions(options);
|
|
31
|
+
const httpOptions = options.httpOptions;
|
|
30
32
|
const response = (
|
|
31
33
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/analyzers?${queryString}`, {
|
|
32
34
|
"method": "PUT",
|
|
33
|
-
"
|
|
34
|
-
"headers": {"Content-Type": "application/json"}
|
|
35
|
+
"data": body,
|
|
36
|
+
"headers": {"Content-Type": "application/json"},
|
|
37
|
+
...httpOptions
|
|
35
38
|
})
|
|
36
|
-
)
|
|
39
|
+
);
|
|
37
40
|
return response;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
async getAll(clusterName, databaseName, collectionName, options) {
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
+
async getAll(clusterName, databaseName, collectionName, options = {}) {
|
|
44
|
+
const queryString = getQueryStringFromOptions(options);
|
|
45
|
+
const httpOptions = options.httpOptions;
|
|
43
46
|
const response = (
|
|
44
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${databaseName}/${collectionName}?${queryString}
|
|
45
|
-
)
|
|
47
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${databaseName}/${collectionName}?${queryString}`, httpOptions)
|
|
48
|
+
);
|
|
46
49
|
return response;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
async delete(clusterName, indexId, options) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
+
async delete(clusterName, indexId, options = {}) {
|
|
53
|
+
const queryString = getQueryStringFromOptions(options);
|
|
54
|
+
const httpOptions = options.httpOptions;
|
|
52
55
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`, {
|
|
53
|
-
"method": "DELETE"
|
|
56
|
+
"method": "DELETE",
|
|
57
|
+
...httpOptions
|
|
54
58
|
});
|
|
55
59
|
return true;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
async update(clusterName, indexId, body, options) {
|
|
59
|
-
const
|
|
60
|
-
const
|
|
62
|
+
async update(clusterName, indexId, body, options = {}) {
|
|
63
|
+
const queryString = getQueryStringFromOptions(options);
|
|
64
|
+
const httpOptions = options.httpOptions;
|
|
61
65
|
const response = (
|
|
62
66
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`, {
|
|
63
67
|
"method": "PATCH",
|
|
64
|
-
"
|
|
65
|
-
"headers": {"Content-Type": "application/json"}
|
|
68
|
+
"data": body,
|
|
69
|
+
"headers": {"Content-Type": "application/json"},
|
|
70
|
+
...httpOptions
|
|
66
71
|
})
|
|
67
|
-
)
|
|
72
|
+
);
|
|
68
73
|
return response;
|
|
69
74
|
}
|
|
70
75
|
|
|
71
|
-
async create(clusterName, body, options) {
|
|
72
|
-
const
|
|
73
|
-
const
|
|
76
|
+
async create(clusterName, body, options = {}) {
|
|
77
|
+
const queryString = getQueryStringFromOptions(options);
|
|
78
|
+
const httpOptions = options.httpOptions;
|
|
74
79
|
const response = (
|
|
75
80
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes?${queryString}`, {
|
|
76
81
|
"method": "POST",
|
|
77
|
-
"
|
|
78
|
-
"headers": {"Content-Type": "application/json"}
|
|
82
|
+
"data": body,
|
|
83
|
+
"headers": {"Content-Type": "application/json"},
|
|
84
|
+
...httpOptions
|
|
79
85
|
})
|
|
80
|
-
)
|
|
86
|
+
);
|
|
81
87
|
return response;
|
|
82
88
|
}
|
|
83
89
|
}
|
package/src/atlasUser.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class AtlasUser {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl, projectId) {
|
|
@@ -6,57 +8,59 @@ class AtlasUser {
|
|
|
6
8
|
this.projectId_ = projectId;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
async getByName(username, options) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
async getByName(username, options = {}) {
|
|
12
|
+
const queryString = getQueryStringFromOptions(options);
|
|
13
|
+
const httpOptions = options.httpOptions;
|
|
12
14
|
const response = (
|
|
13
|
-
await this.client_.fetch(`${this.baseUrl_}/users/byName/${username}?${queryString}
|
|
14
|
-
)
|
|
15
|
+
await this.client_.fetch(`${this.baseUrl_}/users/byName/${username}?${queryString}`, httpOptions)
|
|
16
|
+
);
|
|
15
17
|
return response;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
async getById(userId, options) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
async getById(userId, options = {}) {
|
|
21
|
+
const queryString = getQueryStringFromOptions(options);
|
|
22
|
+
const httpOptions = options.httpOptions;
|
|
21
23
|
const response = (
|
|
22
|
-
await this.client_.fetch(`${this.baseUrl_}/users/${userId}?${queryString}
|
|
23
|
-
)
|
|
24
|
+
await this.client_.fetch(`${this.baseUrl_}/users/${userId}?${queryString}`, httpOptions)
|
|
25
|
+
);
|
|
24
26
|
return response;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
async getAll(options) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
29
|
+
async getAll(options = {}) {
|
|
30
|
+
const queryString = getQueryStringFromOptions(options);
|
|
31
|
+
const httpOptions = options.httpOptions;
|
|
30
32
|
const response = (
|
|
31
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/users?${queryString}
|
|
32
|
-
)
|
|
33
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/users?${queryString}`, httpOptions)
|
|
34
|
+
);
|
|
33
35
|
return response;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
|
|
37
|
-
async update(userId, body, options) {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
39
|
+
async update(userId, body, options = {}) {
|
|
40
|
+
const queryString = getQueryStringFromOptions(options);
|
|
41
|
+
const httpOptions = options.httpOptions;
|
|
40
42
|
const response = (
|
|
41
43
|
await this.client_.fetch(`${this.baseUrl_}/users/${userId}?${queryString}`, {
|
|
42
44
|
"method": "PATCH",
|
|
43
|
-
"
|
|
44
|
-
"headers": {"Content-Type": "application/json"}
|
|
45
|
+
"data": body,
|
|
46
|
+
"headers": {"Content-Type": "application/json"},
|
|
47
|
+
...httpOptions
|
|
45
48
|
})
|
|
46
|
-
)
|
|
49
|
+
);
|
|
47
50
|
return response;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
async create(body, options) {
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
+
async create(body, options = {}) {
|
|
54
|
+
const queryString = getQueryStringFromOptions(options);
|
|
55
|
+
const httpOptions = options.httpOptions;
|
|
53
56
|
const response = (
|
|
54
57
|
await this.client_.fetch(`${this.baseUrl_}/users?${queryString}`, {
|
|
55
58
|
"method": "POST",
|
|
56
|
-
"
|
|
57
|
-
"headers": {"Content-Type": "application/json"}
|
|
59
|
+
"data": body,
|
|
60
|
+
"headers": {"Content-Type": "application/json"},
|
|
61
|
+
...httpOptions
|
|
58
62
|
})
|
|
59
|
-
)
|
|
63
|
+
);
|
|
60
64
|
return response;
|
|
61
65
|
}
|
|
62
66
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class CloudProviderAccess {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl, projectId) {
|
|
@@ -6,47 +8,50 @@ class CloudProviderAccess {
|
|
|
6
8
|
this.projectId_ = projectId;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
async getAll(options) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
async getAll(options = {}) {
|
|
12
|
+
const queryString = getQueryStringFromOptions(options);
|
|
13
|
+
const httpOptions = options.httpOptions;
|
|
12
14
|
const response = (
|
|
13
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess?${queryString}
|
|
14
|
-
)
|
|
15
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess?${queryString}`, httpOptions)
|
|
16
|
+
);
|
|
15
17
|
return response;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
async delete(cloudProvider, roleId, options) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
async delete(cloudProvider, roleId, options = {}) {
|
|
21
|
+
const queryString = getQueryStringFromOptions(options);
|
|
22
|
+
const httpOptions = options.httpOptions;
|
|
21
23
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess/${cloudProvider}/${roleId}?${queryString}`, {
|
|
22
|
-
"method": "DELETE"
|
|
24
|
+
"method": "DELETE",
|
|
25
|
+
...httpOptions
|
|
23
26
|
});
|
|
24
27
|
return true;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
async update(roleId, body, options) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
+
async update(roleId, body, options = {}) {
|
|
31
|
+
const queryString = getQueryStringFromOptions(options);
|
|
32
|
+
const httpOptions = options.httpOptions;
|
|
30
33
|
const response = (
|
|
31
34
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess/${roleId}?${queryString}`, {
|
|
32
35
|
"method": "PATCH",
|
|
33
|
-
"
|
|
34
|
-
"headers": {"Content-Type": "application/json"}
|
|
36
|
+
"data": body,
|
|
37
|
+
"headers": {"Content-Type": "application/json"},
|
|
38
|
+
...httpOptions
|
|
35
39
|
})
|
|
36
|
-
)
|
|
40
|
+
);
|
|
37
41
|
return response;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
async create(body, options) {
|
|
41
|
-
const
|
|
42
|
-
const
|
|
44
|
+
async create(body, options = {}) {
|
|
45
|
+
const queryString = getQueryStringFromOptions(options);
|
|
46
|
+
const httpOptions = options.httpOptions;
|
|
43
47
|
const response = (
|
|
44
48
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess?${queryString}`, {
|
|
45
49
|
"method": "POST",
|
|
46
|
-
"
|
|
47
|
-
"headers": {"Content-Type": "application/json"}
|
|
50
|
+
"data": body,
|
|
51
|
+
"headers": {"Content-Type": "application/json"},
|
|
52
|
+
...httpOptions
|
|
48
53
|
})
|
|
49
|
-
)
|
|
54
|
+
);
|
|
50
55
|
return response;
|
|
51
56
|
}
|
|
52
57
|
}
|
package/src/cluster.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class Cluster {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl, projectId) {
|
|
@@ -6,89 +8,94 @@ class Cluster {
|
|
|
6
8
|
this.projectId_ = projectId;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
async get(clustername, options) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
async get(clustername, options = {}) {
|
|
12
|
+
const queryString = getQueryStringFromOptions(options);
|
|
13
|
+
const httpOptions = options.httpOptions;
|
|
12
14
|
const response = (
|
|
13
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}
|
|
14
|
-
)
|
|
15
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}`, httpOptions)
|
|
16
|
+
);
|
|
15
17
|
return response;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
async getAdvanceConfiguration(clustername, options) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
async getAdvanceConfiguration(clustername, options = {}) {
|
|
21
|
+
const queryString = getQueryStringFromOptions(options);
|
|
22
|
+
const httpOptions = options.httpOptions;
|
|
21
23
|
const response = (
|
|
22
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/processArgs?${queryString}
|
|
23
|
-
)
|
|
24
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/processArgs?${queryString}`, httpOptions)
|
|
25
|
+
);
|
|
24
26
|
return response;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
async getAll(options) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
29
|
+
async getAll(options = {}) {
|
|
30
|
+
const queryString = getQueryStringFromOptions(options);
|
|
31
|
+
const httpOptions = options.httpOptions;
|
|
30
32
|
const response = (
|
|
31
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters?${queryString}
|
|
32
|
-
)
|
|
33
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters?${queryString}`, httpOptions)
|
|
34
|
+
);
|
|
33
35
|
return response;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
async delete(clustername, options) {
|
|
37
|
-
const
|
|
38
|
-
const
|
|
38
|
+
async delete(clustername, options = {}) {
|
|
39
|
+
const queryString = getQueryStringFromOptions(options);
|
|
40
|
+
const httpOptions = options.httpOptions;
|
|
39
41
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}`, {
|
|
40
|
-
"method": "DELETE"
|
|
42
|
+
"method": "DELETE",
|
|
43
|
+
...httpOptions
|
|
41
44
|
});
|
|
42
45
|
return true;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
async update(clustername, body, options) {
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
+
async update(clustername, body, options = {}) {
|
|
49
|
+
const queryString = getQueryStringFromOptions(options);
|
|
50
|
+
const httpOptions = options.httpOptions;
|
|
48
51
|
const response = (
|
|
49
52
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}`, {
|
|
50
53
|
"method": "PATCH",
|
|
51
|
-
"
|
|
52
|
-
"headers": {"Content-Type": "application/json"}
|
|
54
|
+
"data": body,
|
|
55
|
+
"headers": {"Content-Type": "application/json"},
|
|
56
|
+
...httpOptions
|
|
53
57
|
})
|
|
54
|
-
)
|
|
58
|
+
);
|
|
55
59
|
return response;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
async updateAdvanceConfiguration(clustername, body, options) {
|
|
59
|
-
const
|
|
60
|
-
const
|
|
62
|
+
async updateAdvanceConfiguration(clustername, body, options = {}) {
|
|
63
|
+
const queryString = getQueryStringFromOptions(options);
|
|
64
|
+
const httpOptions = options.httpOptions;
|
|
61
65
|
const response = (
|
|
62
66
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/processArgs?${queryString}`, {
|
|
63
67
|
"method": "PATCH",
|
|
64
|
-
"
|
|
65
|
-
"headers": {"Content-Type": "application/json"}
|
|
68
|
+
"data": body,
|
|
69
|
+
"headers": {"Content-Type": "application/json"},
|
|
70
|
+
...httpOptions
|
|
66
71
|
})
|
|
67
|
-
)
|
|
72
|
+
);
|
|
68
73
|
return response;
|
|
69
74
|
}
|
|
70
75
|
|
|
71
|
-
async testPrimaryFailOver(clustername, options) {
|
|
72
|
-
const
|
|
73
|
-
const
|
|
76
|
+
async testPrimaryFailOver(clustername, options = {}) {
|
|
77
|
+
const queryString = getQueryStringFromOptions(options);
|
|
78
|
+
const httpOptions = options.httpOptions;
|
|
74
79
|
const response = (
|
|
75
80
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/restartPrimaries?${queryString}`, {
|
|
76
|
-
"method": "POST"
|
|
81
|
+
"method": "POST",
|
|
82
|
+
...httpOptions
|
|
77
83
|
})
|
|
78
|
-
)
|
|
84
|
+
);
|
|
79
85
|
return response;
|
|
80
86
|
}
|
|
81
87
|
|
|
82
|
-
async create(body, options) {
|
|
83
|
-
const
|
|
84
|
-
const
|
|
88
|
+
async create(body, options = {}) {
|
|
89
|
+
const queryString = getQueryStringFromOptions(options);
|
|
90
|
+
const httpOptions = options.httpOptions;
|
|
85
91
|
const response = (
|
|
86
92
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters?${queryString}`, {
|
|
87
93
|
"method": "POST",
|
|
88
|
-
"
|
|
89
|
-
"headers": {"Content-Type": "application/json"}
|
|
94
|
+
"data": body,
|
|
95
|
+
"headers": {"Content-Type": "application/json"},
|
|
96
|
+
...httpOptions
|
|
90
97
|
})
|
|
91
|
-
)
|
|
98
|
+
);
|
|
92
99
|
return response;
|
|
93
100
|
}
|
|
94
101
|
}
|
package/src/customDbRole.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class CustomDbRole {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl, projectId) {
|
|
@@ -6,56 +8,59 @@ class CustomDbRole {
|
|
|
6
8
|
this.projectId_ = projectId;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
async get(rolename, options) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
async get(rolename, options = {}) {
|
|
12
|
+
const queryString = getQueryStringFromOptions(options);
|
|
13
|
+
const httpOptions = options.httpOptions;
|
|
12
14
|
const response = (
|
|
13
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles/${rolename}?${queryString}
|
|
14
|
-
)
|
|
15
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles/${rolename}?${queryString}`, httpOptions)
|
|
16
|
+
);
|
|
15
17
|
return response;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
async getAll(options) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
async getAll(options = {}) {
|
|
21
|
+
const queryString = getQueryStringFromOptions(options);
|
|
22
|
+
const httpOptions = options.httpOptions;
|
|
21
23
|
const response = (
|
|
22
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles?${queryString}
|
|
23
|
-
)
|
|
24
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles?${queryString}`, httpOptions)
|
|
25
|
+
);
|
|
24
26
|
return response;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
async delete(rolename, options) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
29
|
+
async delete(rolename, options = {}) {
|
|
30
|
+
const queryString = getQueryStringFromOptions(options);
|
|
31
|
+
const httpOptions = options.httpOptions;
|
|
30
32
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles/${rolename}?${queryString}`, {
|
|
31
|
-
"method": "DELETE"
|
|
33
|
+
"method": "DELETE",
|
|
34
|
+
...httpOptions
|
|
32
35
|
});
|
|
33
36
|
return true;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
async update(rolename, body, options) {
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
+
async update(rolename, body, options = {}) {
|
|
40
|
+
const queryString = getQueryStringFromOptions(options);
|
|
41
|
+
const httpOptions = options.httpOptions;
|
|
39
42
|
const response = (
|
|
40
43
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles/${rolename}?${queryString}`, {
|
|
41
44
|
"method": "PATCH",
|
|
42
|
-
"
|
|
43
|
-
"headers": {"Content-Type": "application/json"}
|
|
45
|
+
"data": body,
|
|
46
|
+
"headers": {"Content-Type": "application/json"},
|
|
47
|
+
...httpOptions
|
|
44
48
|
})
|
|
45
|
-
)
|
|
49
|
+
);
|
|
46
50
|
return response;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
async create(body, options) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
53
|
+
async create(body, options = {}) {
|
|
54
|
+
const queryString = getQueryStringFromOptions(options);
|
|
55
|
+
const httpOptions = options.httpOptions;
|
|
52
56
|
const response = (
|
|
53
57
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles?${queryString}`, {
|
|
54
58
|
"method": "POST",
|
|
55
|
-
"
|
|
56
|
-
"headers": {"Content-Type": "application/json"}
|
|
59
|
+
"data": body,
|
|
60
|
+
"headers": {"Content-Type": "application/json"},
|
|
61
|
+
...httpOptions
|
|
57
62
|
})
|
|
58
|
-
)
|
|
63
|
+
);
|
|
59
64
|
return response;
|
|
60
65
|
}
|
|
61
66
|
}
|