mongodb-atlas-api-client 2.24.0 → 2.28.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/README.md +95 -0
- package/package.json +2 -3
- package/src/alert.js +6 -5
- package/src/atlasSearch.d.ts +17 -0
- package/src/atlasSearch.js +86 -0
- package/src/atlasUser.js +10 -7
- package/src/cloudProviderAccess.js +8 -6
- package/src/cluster.js +16 -10
- package/src/customDbRole.js +10 -7
- package/src/dataLake.js +12 -8
- package/src/event.js +8 -6
- package/src/index.d.ts +3 -0
- package/src/index.js +3 -0
- package/src/organization.js +12 -8
- package/src/project.js +16 -10
- package/src/projectAccesslist.js +10 -7
- package/src/projectWhitelist.js +10 -7
- package/src/user.js +10 -7
- package/test/atlasSearch.test.js +106 -0
package/README.md
CHANGED
|
@@ -64,6 +64,7 @@ Following entities are currently supported
|
|
|
64
64
|
- [Event](#event)
|
|
65
65
|
- [Alert](#alert)
|
|
66
66
|
- [DataLake](#datalake)
|
|
67
|
+
- [AtlasSearch](#atlassearch)
|
|
67
68
|
|
|
68
69
|
### User
|
|
69
70
|
|
|
@@ -857,4 +858,98 @@ Function - Deletes the cloudProviderAccess name passed.
|
|
|
857
858
|
|
|
858
859
|
More details - https://docs.atlas.mongodb.com/reference/api/cloud-provider-access-deauthorize-one-role/
|
|
859
860
|
|
|
861
|
+
### AtlasSearch
|
|
862
|
+
|
|
863
|
+
### atlasSearch.get(clusterName, indexId, [options]) ⇒ <code>Promise</code>
|
|
864
|
+
Function - Returns the details of atlas search index by cluster name and index passed.
|
|
865
|
+
|
|
866
|
+
**Returns**: <code>Promise</code> - - promise which resolves on success and rejects on error
|
|
867
|
+
|
|
868
|
+
| Param | Type | Default | Description |
|
|
869
|
+
| --- | --- | --- | --- |
|
|
870
|
+
| clusterName | <code>String</code> | | name of the cluster for which details needs to be retrieved |
|
|
871
|
+
| indexId | <code>String</code> | | id of the index for which details needs to be retrieved |
|
|
872
|
+
| [options] | <code>Object</code> | <code>{}</code> | Optional object containing extra query strings which will be passed to atlas api |
|
|
873
|
+
|
|
874
|
+
More details - https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-one/
|
|
875
|
+
|
|
876
|
+
### atlasSearch.getAll(clusterName, databaseName, collectionName, [options]) ⇒ <code>Promise</code>
|
|
877
|
+
Function - Returns all the atlas search indexes. Pagination can be controlled via options object.
|
|
878
|
+
|
|
879
|
+
**Returns**: <code>Promise</code> - - promise which resolves on success and rejects on error
|
|
880
|
+
|
|
881
|
+
| Param | Type | Default | Description |
|
|
882
|
+
| --- | --- | --- | --- |
|
|
883
|
+
| clusterName | <code>String</code> | | name of the cluster for which details needs to be retrieved |
|
|
884
|
+
| databaseName | <code>String</code> | | name of the database for which details needs to be retrieved |
|
|
885
|
+
| collectionName | <code>String</code> | | name of the collection for which details needs to be retrieved |
|
|
886
|
+
| [options] | <code>Object</code> | <code>{}</code> | Optional object containing extra query strings which will be passed to atlas api |
|
|
887
|
+
|
|
888
|
+
More details - https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/
|
|
889
|
+
|
|
890
|
+
### atlasSearch.getAllAnalyzers(clusterName, [options]) ⇒ <code>Promise</code>
|
|
891
|
+
Function - Returns all the Analyzers. Pagination can be controlled via options object.
|
|
892
|
+
|
|
893
|
+
**Returns**: <code>Promise</code> - - promise which resolves on success and rejects on error
|
|
894
|
+
|
|
895
|
+
| Param | Type | Default | Description |
|
|
896
|
+
| --- | --- | --- | --- |
|
|
897
|
+
| clusterName | <code>String</code> | | name of the cluster for which details needs to be retrieved |
|
|
898
|
+
| [options] | <code>Object</code> | <code>{}</code> | Optional object containing extra query strings which will be passed to atlas api |
|
|
899
|
+
|
|
900
|
+
More details - https://docs.atlas.mongodb.com/reference/api/fts-analyzers-get-all/
|
|
901
|
+
|
|
902
|
+
### atlasSearch.create(clusterName, body, [options]) ⇒ <code>Promise</code>
|
|
903
|
+
Function - Creates the atlas search index as per body passed.
|
|
904
|
+
|
|
905
|
+
**Returns**: <code>Promise</code> - - promise which resolves on success and rejects on error
|
|
906
|
+
|
|
907
|
+
| Param | Type | Default | Description |
|
|
908
|
+
| --- | --- | --- | --- |
|
|
909
|
+
| clusterName | <code>String</code> | | name of the cluster for which details needs to be retrieved |
|
|
910
|
+
| body | <code>Object</code> | | Body which has details for cluster which needs to be created |
|
|
911
|
+
| [options] | <code>Object</code> | <code>{}</code> | Optional object containing extra query strings which will be passed to atlas api |
|
|
912
|
+
|
|
913
|
+
More details - https://docs.atlas.mongodb.com/reference/api/fts-indexes-create-one/
|
|
914
|
+
|
|
915
|
+
### atlasSearch.update(clusterName, indexId, body, [options]) ⇒ <code>Promise</code>
|
|
916
|
+
Function - Updates the atlas search index for the clusterName passed. It only updates the properties passed in body.
|
|
917
|
+
|
|
918
|
+
**Returns**: <code>Promise</code> - - promise which resolves on success and rejects on error
|
|
919
|
+
|
|
920
|
+
| Param | Type | Default | Description |
|
|
921
|
+
| --- | --- | --- | --- |
|
|
922
|
+
| clusterName | <code>String</code> | | name of the cluster for which details needs to be updated |
|
|
923
|
+
| indexId | <code>String</code> | | name of the index for which details needs to be updated |
|
|
924
|
+
| body | <code>Object</code> | | Body which has details for cluster which needs to be updated |
|
|
925
|
+
| [options] | <code>Object</code> | <code>{}</code> | Optional object containing extra query strings which will be passed to atlas api |
|
|
926
|
+
|
|
927
|
+
More details - https://docs.atlas.mongodb.com/reference/api/fts-indexes-update-one/
|
|
928
|
+
|
|
929
|
+
### atlasSearch.upsertAnalyzer(clusterName, body, [options]) ⇒ <code>Promise</code>
|
|
930
|
+
Function - Upserts the analyser for the clusterName passed.
|
|
931
|
+
|
|
932
|
+
**Returns**: <code>Promise</code> - - promise which resolves on success and rejects on error
|
|
933
|
+
|
|
934
|
+
| Param | Type | Default | Description |
|
|
935
|
+
| --- | --- | --- | --- |
|
|
936
|
+
| clusterName | <code>String</code> | | name of the cluster for which details needs to be upserted |
|
|
937
|
+
| body | <code>Object</code> | | Body which has details for cluster which needs to be upserted |
|
|
938
|
+
| [options] | <code>Object</code> | <code>{}</code> | Optional object containing extra query strings which will be passed to atlas api |
|
|
939
|
+
|
|
940
|
+
More details - https://docs.atlas.mongodb.com/reference/api/fts-analyzers-update-all/
|
|
941
|
+
|
|
942
|
+
### atlasSearch.delete(clusterName, indexId, [options]) ⇒ <code>Promise</code>
|
|
943
|
+
Function - Deletes the atlas search index by cluster name passed.
|
|
944
|
+
|
|
945
|
+
**Returns**: <code>Promise</code> - - promise which resolves on success and rejects on error
|
|
946
|
+
|
|
947
|
+
| Param | Type | Default | Description |
|
|
948
|
+
| --- | --- | --- | --- |
|
|
949
|
+
| clusterName | <code>String</code> | | name of the cluster which needs to be deleted |
|
|
950
|
+
| indexId | <code>String</code> | | name of the index for which details needs to be deleted |
|
|
951
|
+
| [options] | <code>Object</code> | <code>{}</code> | Optional object containing extra query strings which will be passed to atlas api |
|
|
952
|
+
|
|
953
|
+
More details - https://docs.atlas.mongodb.com/reference/api/fts-indexes-delete-one/
|
|
954
|
+
|
|
860
955
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongodb-atlas-api-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0",
|
|
4
4
|
"description": "A mongodb atlas api client for nodejs.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"digest-fetch": "^1.1.6",
|
|
52
|
-
"node-fetch": "^2.6.
|
|
53
|
-
"qs": "^6.9.6"
|
|
52
|
+
"node-fetch": "^2.6.5"
|
|
54
53
|
}
|
|
55
54
|
}
|
package/src/alert.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class Alert {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class Alert {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async getAll(options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class Alert {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async get(alertId, options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
const response = (
|
|
22
22
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts/${alertId}?${queryString}`)
|
|
23
23
|
).json();
|
|
@@ -25,7 +25,8 @@ class Alert {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async acknowledge(alertId, body, options) {
|
|
28
|
-
const
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
29
30
|
const response = (
|
|
30
31
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts/${alertId}?${queryString}`, {
|
|
31
32
|
"method": "PATCH",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {AtlasClientOptions, AtlasError} from '.';
|
|
2
|
+
|
|
3
|
+
// DataLakeClient
|
|
4
|
+
export type ClusterName = string;
|
|
5
|
+
export type IndexId = string;
|
|
6
|
+
export type DatabaseName = string;
|
|
7
|
+
export type CollectionName = string;
|
|
8
|
+
|
|
9
|
+
export interface AtlasSearch {
|
|
10
|
+
get(clusterName: ClusterName, indexId: IndexId, options?: AtlasClientOptions): Promise<any | AtlasError>;
|
|
11
|
+
getAll(clusterName: ClusterName, databaseName: DatabaseName, collectionName: CollectionName, options?: AtlasClientOptions): Promise<any | AtlasError>;
|
|
12
|
+
delete(clusterName: ClusterName, indexId: IndexId, options?: AtlasClientOptions): Promise<any | AtlasError>;
|
|
13
|
+
update(clusterName: ClusterName, indexId: IndexId, body: object, options?: AtlasClientOptions): Promise<any | AtlasError>;
|
|
14
|
+
create(clusterName: ClusterName, body: object, options?: AtlasClientOptions): Promise<any | AtlasError>;
|
|
15
|
+
getAllAnalyzers(clusterName: ClusterName, options?: AtlasClientOptions): Promise<any | AtlasError>;
|
|
16
|
+
upsertAnalyzer(clusterName: ClusterName, body: object, options?: AtlasClientOptions): Promise<any | AtlasError>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
class AtlasSearch {
|
|
2
|
+
|
|
3
|
+
constructor(client, baseUrl, projectId) {
|
|
4
|
+
this.client_ = client;
|
|
5
|
+
this.baseUrl_ = baseUrl;
|
|
6
|
+
this.projectId_ = projectId;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async get(clusterName, indexId, options) {
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
12
|
+
const response = (
|
|
13
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`)
|
|
14
|
+
).json();
|
|
15
|
+
return response;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async getAllAnalyzers(clusterName, options) {
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
|
+
const response = (
|
|
22
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/analyzers?${queryString}`)
|
|
23
|
+
).json();
|
|
24
|
+
return response;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async upsertAnalyzer(clusterName, body, options) {
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
30
|
+
const response = (
|
|
31
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/analyzers?${queryString}`, {
|
|
32
|
+
"method": "PUT",
|
|
33
|
+
"body": JSON.stringify(body),
|
|
34
|
+
"headers": {"Content-Type": "application/json"}
|
|
35
|
+
})
|
|
36
|
+
).json();
|
|
37
|
+
return response;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async getAll(clusterName, databaseName, collectionName, options) {
|
|
41
|
+
const urlparams = new URLSearchParams(options);
|
|
42
|
+
const queryString = urlparams.toString();
|
|
43
|
+
const response = (
|
|
44
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${databaseName}/${collectionName}?${queryString}`)
|
|
45
|
+
).json();
|
|
46
|
+
return response;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async delete(clusterName, indexId, options) {
|
|
50
|
+
const urlparams = new URLSearchParams(options);
|
|
51
|
+
const queryString = urlparams.toString();
|
|
52
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`, {
|
|
53
|
+
"method": "DELETE"
|
|
54
|
+
});
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async update(clusterName, indexId, body, options) {
|
|
59
|
+
const urlparams = new URLSearchParams(options);
|
|
60
|
+
const queryString = urlparams.toString();
|
|
61
|
+
const response = (
|
|
62
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`, {
|
|
63
|
+
"method": "PATCH",
|
|
64
|
+
"body": JSON.stringify(body),
|
|
65
|
+
"headers": {"Content-Type": "application/json"}
|
|
66
|
+
})
|
|
67
|
+
).json();
|
|
68
|
+
return response;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async create(clusterName, body, options) {
|
|
72
|
+
const urlparams = new URLSearchParams(options);
|
|
73
|
+
const queryString = urlparams.toString();
|
|
74
|
+
const response = (
|
|
75
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes?${queryString}`, {
|
|
76
|
+
"method": "POST",
|
|
77
|
+
"body": JSON.stringify(body),
|
|
78
|
+
"headers": {"Content-Type": "application/json"}
|
|
79
|
+
})
|
|
80
|
+
).json();
|
|
81
|
+
return response;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = AtlasSearch;
|
|
86
|
+
|
package/src/atlasUser.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class AtlasUser {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class AtlasUser {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async getByName(username, options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/users/byName/${username}?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class AtlasUser {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async getById(userId, options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
const response = (
|
|
22
22
|
await this.client_.fetch(`${this.baseUrl_}/users/${userId}?${queryString}`)
|
|
23
23
|
).json();
|
|
@@ -25,7 +25,8 @@ class AtlasUser {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async getAll(options) {
|
|
28
|
-
const
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
29
30
|
const response = (
|
|
30
31
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/users?${queryString}`)
|
|
31
32
|
).json();
|
|
@@ -34,7 +35,8 @@ class AtlasUser {
|
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
async update(userId, body, options) {
|
|
37
|
-
const
|
|
38
|
+
const urlparams = new URLSearchParams(options);
|
|
39
|
+
const queryString = urlparams.toString();
|
|
38
40
|
const response = (
|
|
39
41
|
await this.client_.fetch(`${this.baseUrl_}/users/${userId}?${queryString}`, {
|
|
40
42
|
"method": "PATCH",
|
|
@@ -46,7 +48,8 @@ class AtlasUser {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
async create(body, options) {
|
|
49
|
-
const
|
|
51
|
+
const urlparams = new URLSearchParams(options);
|
|
52
|
+
const queryString = urlparams.toString();
|
|
50
53
|
const response = (
|
|
51
54
|
await this.client_.fetch(`${this.baseUrl_}/users?${queryString}`, {
|
|
52
55
|
"method": "POST",
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class CloudProviderAccess {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class CloudProviderAccess {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async getAll(options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class CloudProviderAccess {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async delete(cloudProvider, roleId, options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess/${cloudProvider}/${roleId}?${queryString}`, {
|
|
22
22
|
"method": "DELETE"
|
|
23
23
|
});
|
|
@@ -25,7 +25,8 @@ class CloudProviderAccess {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async update(roleId, body, options) {
|
|
28
|
-
const
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
29
30
|
const response = (
|
|
30
31
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess/${roleId}?${queryString}`, {
|
|
31
32
|
"method": "PATCH",
|
|
@@ -37,7 +38,8 @@ class CloudProviderAccess {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
async create(body, options) {
|
|
40
|
-
const
|
|
41
|
+
const urlparams = new URLSearchParams(options);
|
|
42
|
+
const queryString = urlparams.toString();
|
|
41
43
|
const response = (
|
|
42
44
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess?${queryString}`, {
|
|
43
45
|
"method": "POST",
|
package/src/cluster.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class Cluster {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class Cluster {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async get(clustername, options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class Cluster {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async getAdvanceConfiguration(clustername, options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
const response = (
|
|
22
22
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/processArgs?${queryString}`)
|
|
23
23
|
).json();
|
|
@@ -25,7 +25,8 @@ class Cluster {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async getAll(options) {
|
|
28
|
-
const
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
29
30
|
const response = (
|
|
30
31
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters?${queryString}`)
|
|
31
32
|
).json();
|
|
@@ -33,7 +34,8 @@ class Cluster {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
async delete(clustername, options) {
|
|
36
|
-
const
|
|
37
|
+
const urlparams = new URLSearchParams(options);
|
|
38
|
+
const queryString = urlparams.toString();
|
|
37
39
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}`, {
|
|
38
40
|
"method": "DELETE"
|
|
39
41
|
});
|
|
@@ -41,7 +43,8 @@ class Cluster {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
async update(clustername, body, options) {
|
|
44
|
-
const
|
|
46
|
+
const urlparams = new URLSearchParams(options);
|
|
47
|
+
const queryString = urlparams.toString();
|
|
45
48
|
const response = (
|
|
46
49
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}`, {
|
|
47
50
|
"method": "PATCH",
|
|
@@ -53,7 +56,8 @@ class Cluster {
|
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
async updateAdvanceConfiguration(clustername, body, options) {
|
|
56
|
-
const
|
|
59
|
+
const urlparams = new URLSearchParams(options);
|
|
60
|
+
const queryString = urlparams.toString();
|
|
57
61
|
const response = (
|
|
58
62
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/processArgs?${queryString}`, {
|
|
59
63
|
"method": "PATCH",
|
|
@@ -65,7 +69,8 @@ class Cluster {
|
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
async testPrimaryFailOver(clustername, options) {
|
|
68
|
-
const
|
|
72
|
+
const urlparams = new URLSearchParams(options);
|
|
73
|
+
const queryString = urlparams.toString();
|
|
69
74
|
const response = (
|
|
70
75
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/restartPrimaries?${queryString}`, {
|
|
71
76
|
"method": "POST"
|
|
@@ -75,7 +80,8 @@ class Cluster {
|
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
async create(body, options) {
|
|
78
|
-
const
|
|
83
|
+
const urlparams = new URLSearchParams(options);
|
|
84
|
+
const queryString = urlparams.toString();
|
|
79
85
|
const response = (
|
|
80
86
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters?${queryString}`, {
|
|
81
87
|
"method": "POST",
|
package/src/customDbRole.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class CustomDbRole {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class CustomDbRole {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async get(rolename, options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles/${rolename}?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class CustomDbRole {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async getAll(options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
const response = (
|
|
22
22
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles?${queryString}`)
|
|
23
23
|
).json();
|
|
@@ -25,7 +25,8 @@ class CustomDbRole {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async delete(rolename, options) {
|
|
28
|
-
const
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
29
30
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles/${rolename}?${queryString}`, {
|
|
30
31
|
"method": "DELETE"
|
|
31
32
|
});
|
|
@@ -33,7 +34,8 @@ class CustomDbRole {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
async update(rolename, body, options) {
|
|
36
|
-
const
|
|
37
|
+
const urlparams = new URLSearchParams(options);
|
|
38
|
+
const queryString = urlparams.toString();
|
|
37
39
|
const response = (
|
|
38
40
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles/${rolename}?${queryString}`, {
|
|
39
41
|
"method": "PATCH",
|
|
@@ -45,7 +47,8 @@ class CustomDbRole {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
async create(body, options) {
|
|
48
|
-
const
|
|
50
|
+
const urlparams = new URLSearchParams(options);
|
|
51
|
+
const queryString = urlparams.toString();
|
|
49
52
|
const response = (
|
|
50
53
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles?${queryString}`, {
|
|
51
54
|
"method": "POST",
|
package/src/dataLake.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class DataLake {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class DataLake {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async get(dataLakeName, options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes/${dataLakeName}?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class DataLake {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async getLogsStream(dataLakeName, options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
const response = (
|
|
22
22
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes/${dataLakeName}/queryLogs.gz?${queryString}`, {
|
|
23
23
|
"headers": {
|
|
@@ -29,7 +29,8 @@ class DataLake {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
async getAll(options) {
|
|
32
|
-
const
|
|
32
|
+
const urlparams = new URLSearchParams(options);
|
|
33
|
+
const queryString = urlparams.toString();
|
|
33
34
|
const response = (
|
|
34
35
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes?${queryString}`)
|
|
35
36
|
).json();
|
|
@@ -37,7 +38,8 @@ class DataLake {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
async delete(dataLakeName, options) {
|
|
40
|
-
const
|
|
41
|
+
const urlparams = new URLSearchParams(options);
|
|
42
|
+
const queryString = urlparams.toString();
|
|
41
43
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes/${dataLakeName}?${queryString}`, {
|
|
42
44
|
"method": "DELETE"
|
|
43
45
|
});
|
|
@@ -45,7 +47,8 @@ class DataLake {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
async update(dataLakeName, body, options) {
|
|
48
|
-
const
|
|
50
|
+
const urlparams = new URLSearchParams(options);
|
|
51
|
+
const queryString = urlparams.toString();
|
|
49
52
|
const response = (
|
|
50
53
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes/${dataLakeName}?${queryString}`, {
|
|
51
54
|
"method": "PATCH",
|
|
@@ -57,7 +60,8 @@ class DataLake {
|
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
async create(body, options) {
|
|
60
|
-
const
|
|
63
|
+
const urlparams = new URLSearchParams(options);
|
|
64
|
+
const queryString = urlparams.toString();
|
|
61
65
|
const response = (
|
|
62
66
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes?${queryString}`, {
|
|
63
67
|
"method": "POST",
|
package/src/event.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class Event {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class Event {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async get(eventId, options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/events/${eventId}?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class Event {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async getAll(options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
const response = (
|
|
22
22
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/events?${queryString}`)
|
|
23
23
|
).json();
|
|
@@ -25,7 +25,8 @@ class Event {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async getByOrganizationId(organizationId, eventId, options) {
|
|
28
|
-
const
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
29
30
|
const response = (
|
|
30
31
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/events/${eventId}?${queryString}`)
|
|
31
32
|
).json();
|
|
@@ -33,7 +34,8 @@ class Event {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
async getAllByOrganizationId(organizationId, options) {
|
|
36
|
-
const
|
|
37
|
+
const urlparams = new URLSearchParams(options);
|
|
38
|
+
const queryString = urlparams.toString();
|
|
37
39
|
const response = (
|
|
38
40
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/events?${queryString}`)
|
|
39
41
|
).json();
|
package/src/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {ProjectAccesslist} from './projectAccesslist';
|
|
|
10
10
|
import {User} from './user';
|
|
11
11
|
import {DataLake} from './dataLake';
|
|
12
12
|
import {CloudProviderAccess} from './cloudProviderAccess';
|
|
13
|
+
import {AtlasSearch} from './atlasSearch';
|
|
13
14
|
|
|
14
15
|
export * from './alert'
|
|
15
16
|
export * from './atlasUser';
|
|
@@ -23,6 +24,7 @@ export * from './projectAccesslist';
|
|
|
23
24
|
export * from './user';
|
|
24
25
|
export * from './dataLake'
|
|
25
26
|
export * from './cloudProviderAccess';
|
|
27
|
+
export * from './atlasSearch';
|
|
26
28
|
|
|
27
29
|
export interface KeyValuePairDocument {
|
|
28
30
|
key: string;
|
|
@@ -67,6 +69,7 @@ export interface AtlasClient {
|
|
|
67
69
|
event: Event;
|
|
68
70
|
dataLake: DataLake;
|
|
69
71
|
cloudProviderAccess: CloudProviderAccess;
|
|
72
|
+
atlasSearch: AtlasSearch
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
export interface AtlasClientConfig {
|
package/src/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const Event = require("./event");
|
|
|
10
10
|
const Alert = require("./alert");
|
|
11
11
|
const DataLake = require("./dataLake");
|
|
12
12
|
const CloudProviderAccess = require("./cloudProviderAccess");
|
|
13
|
+
const AtlasSearch = require("./atlasSearch");
|
|
13
14
|
const DigestFetch = require("digest-fetch");
|
|
14
15
|
|
|
15
16
|
function getFunctions(instance) {
|
|
@@ -40,6 +41,7 @@ function getMongodbAtlasApiClient(options) {
|
|
|
40
41
|
const alert = new Alert(client, options.baseUrl, options.projectId);
|
|
41
42
|
const dataLake = new DataLake(client, options.baseUrl, options.projectId);
|
|
42
43
|
const cloudProviderAccess = new CloudProviderAccess(client, options.baseUrl, options.projectId);
|
|
44
|
+
const atlasSearch = new AtlasSearch(client, options.baseUrl, options.projectId);
|
|
43
45
|
|
|
44
46
|
const functions = {};
|
|
45
47
|
functions.user = getFunctions(user);
|
|
@@ -54,6 +56,7 @@ function getMongodbAtlasApiClient(options) {
|
|
|
54
56
|
functions.alert = getFunctions(alert);
|
|
55
57
|
functions.dataLake = getFunctions(dataLake);
|
|
56
58
|
functions.cloudProviderAccess = getFunctions(cloudProviderAccess);
|
|
59
|
+
functions.atlasSearch = getFunctions(atlasSearch);
|
|
57
60
|
|
|
58
61
|
return functions;
|
|
59
62
|
}
|
package/src/organization.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class Organization {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl) {
|
|
@@ -8,7 +6,8 @@ class Organization {
|
|
|
8
6
|
}
|
|
9
7
|
|
|
10
8
|
async getById(organizationId, options) {
|
|
11
|
-
const
|
|
9
|
+
const urlparams = new URLSearchParams(options);
|
|
10
|
+
const queryString = urlparams.toString();
|
|
12
11
|
const response = (
|
|
13
12
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}?${queryString}`)
|
|
14
13
|
).json();
|
|
@@ -16,7 +15,8 @@ class Organization {
|
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
async getAllUsersForOrganization(organizationId, options) {
|
|
19
|
-
const
|
|
18
|
+
const urlparams = new URLSearchParams(options);
|
|
19
|
+
const queryString = urlparams.toString();
|
|
20
20
|
const response = (
|
|
21
21
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/users?${queryString}`)
|
|
22
22
|
).json();
|
|
@@ -24,7 +24,8 @@ class Organization {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async getAllProjectsForOrganization(organizationId, options) {
|
|
27
|
-
const
|
|
27
|
+
const urlparams = new URLSearchParams(options);
|
|
28
|
+
const queryString = urlparams.toString();
|
|
28
29
|
const response = (
|
|
29
30
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/groups?${queryString}`)
|
|
30
31
|
).json();
|
|
@@ -32,7 +33,8 @@ class Organization {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
async getAll(options) {
|
|
35
|
-
const
|
|
36
|
+
const urlparams = new URLSearchParams(options);
|
|
37
|
+
const queryString = urlparams.toString();
|
|
36
38
|
const response = (
|
|
37
39
|
await this.client_.fetch(`${this.baseUrl_}/orgs?${queryString}`)
|
|
38
40
|
).json();
|
|
@@ -40,7 +42,8 @@ class Organization {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
async delete(organizationId, options) {
|
|
43
|
-
const
|
|
45
|
+
const urlparams = new URLSearchParams(options);
|
|
46
|
+
const queryString = urlparams.toString();
|
|
44
47
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}?${queryString}`, {
|
|
45
48
|
"method": "DELETE"
|
|
46
49
|
});
|
|
@@ -48,7 +51,8 @@ class Organization {
|
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
async rename(organizationId, body, options) {
|
|
51
|
-
const
|
|
54
|
+
const urlparams = new URLSearchParams(options);
|
|
55
|
+
const queryString = urlparams.toString();
|
|
52
56
|
const response = (
|
|
53
57
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}?${queryString}`, {
|
|
54
58
|
"method": "PATCH",
|
package/src/project.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class Project {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl) {
|
|
@@ -8,7 +6,8 @@ class Project {
|
|
|
8
6
|
}
|
|
9
7
|
|
|
10
8
|
async getById(projectId, options) {
|
|
11
|
-
const
|
|
9
|
+
const urlparams = new URLSearchParams(options);
|
|
10
|
+
const queryString = urlparams.toString();
|
|
12
11
|
const response = (
|
|
13
12
|
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}?${queryString}`)
|
|
14
13
|
).json();
|
|
@@ -16,7 +15,8 @@ class Project {
|
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
async getByName(projectName, options) {
|
|
19
|
-
const
|
|
18
|
+
const urlparams = new URLSearchParams(options);
|
|
19
|
+
const queryString = urlparams.toString();
|
|
20
20
|
const response = (
|
|
21
21
|
await this.client_.fetch(`${this.baseUrl_}/groups/byName/${projectName}?${queryString}`)
|
|
22
22
|
).json();
|
|
@@ -24,7 +24,8 @@ class Project {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async getTeamsByProjectId(projectId, options) {
|
|
27
|
-
const
|
|
27
|
+
const urlparams = new URLSearchParams(options);
|
|
28
|
+
const queryString = urlparams.toString();
|
|
28
29
|
const response = (
|
|
29
30
|
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}/teams?${queryString}`)
|
|
30
31
|
).json();
|
|
@@ -32,7 +33,8 @@ class Project {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
async getAll(options) {
|
|
35
|
-
const
|
|
36
|
+
const urlparams = new URLSearchParams(options);
|
|
37
|
+
const queryString = urlparams.toString();
|
|
36
38
|
const response = (
|
|
37
39
|
await this.client_.fetch(`${this.baseUrl_}/groups?${queryString}`)
|
|
38
40
|
).json();
|
|
@@ -40,7 +42,8 @@ class Project {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
async delete(projectId, options) {
|
|
43
|
-
const
|
|
45
|
+
const urlparams = new URLSearchParams(options);
|
|
46
|
+
const queryString = urlparams.toString();
|
|
44
47
|
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}?${queryString}`, {
|
|
45
48
|
"method": "DELETE"
|
|
46
49
|
});
|
|
@@ -48,7 +51,8 @@ class Project {
|
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
async removeUserFromProject(projectId, userId, options) {
|
|
51
|
-
const
|
|
54
|
+
const urlparams = new URLSearchParams(options);
|
|
55
|
+
const queryString = urlparams.toString();
|
|
52
56
|
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}/users/${userId}?${queryString}`, {
|
|
53
57
|
"method": "DELETE"
|
|
54
58
|
});
|
|
@@ -56,7 +60,8 @@ class Project {
|
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
async assignTeams(projectId, body, options) {
|
|
59
|
-
const
|
|
63
|
+
const urlparams = new URLSearchParams(options);
|
|
64
|
+
const queryString = urlparams.toString();
|
|
60
65
|
const response = (
|
|
61
66
|
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}/teams?${queryString}`, {
|
|
62
67
|
"method": "POST",
|
|
@@ -68,7 +73,8 @@ class Project {
|
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
async create(body, options) {
|
|
71
|
-
const
|
|
76
|
+
const urlparams = new URLSearchParams(options);
|
|
77
|
+
const queryString = urlparams.toString();
|
|
72
78
|
const response = (
|
|
73
79
|
await this.client_.fetch(`${this.baseUrl_}/groups?${queryString}`, {
|
|
74
80
|
"method": "POST",
|
package/src/projectAccesslist.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class ProjectAccesslist {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class ProjectAccesslist {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async get(accesslistentry, options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList/${accesslistentry}?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class ProjectAccesslist {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async getAll(options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
const response = (
|
|
22
22
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList?${queryString}`)
|
|
23
23
|
).json();
|
|
@@ -25,7 +25,8 @@ class ProjectAccesslist {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async delete(accesslistentry, options) {
|
|
28
|
-
const
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
29
30
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList/${accesslistentry}?${queryString}`, {
|
|
30
31
|
"method": "DELETE"
|
|
31
32
|
});
|
|
@@ -33,7 +34,8 @@ class ProjectAccesslist {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
async update(body, options) {
|
|
36
|
-
const
|
|
37
|
+
const urlparams = new URLSearchParams(options);
|
|
38
|
+
const queryString = urlparams.toString();
|
|
37
39
|
const response = (
|
|
38
40
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList?${queryString}`, {
|
|
39
41
|
"method": "POST",
|
|
@@ -45,7 +47,8 @@ class ProjectAccesslist {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
async create(body, options) {
|
|
48
|
-
const
|
|
50
|
+
const urlparams = new URLSearchParams(options);
|
|
51
|
+
const queryString = urlparams.toString();
|
|
49
52
|
const response = (
|
|
50
53
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList?${queryString}`, {
|
|
51
54
|
"method": "POST",
|
package/src/projectWhitelist.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class ProjectWhitelist {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class ProjectWhitelist {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async get(whitelistentry, options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/whitelist/${whitelistentry}?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class ProjectWhitelist {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async getAll(options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
const response = (
|
|
22
22
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/whitelist?${queryString}`)
|
|
23
23
|
).json();
|
|
@@ -25,7 +25,8 @@ class ProjectWhitelist {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async delete(whitelistentry, options) {
|
|
28
|
-
const
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
29
30
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/whitelist/${whitelistentry}?${queryString}`, {
|
|
30
31
|
"method": "DELETE"
|
|
31
32
|
});
|
|
@@ -33,7 +34,8 @@ class ProjectWhitelist {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
async update(body, options) {
|
|
36
|
-
const
|
|
37
|
+
const urlparams = new URLSearchParams(options);
|
|
38
|
+
const queryString = urlparams.toString();
|
|
37
39
|
const response = (
|
|
38
40
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/whitelist?${queryString}`, {
|
|
39
41
|
"method": "POST",
|
|
@@ -45,7 +47,8 @@ class ProjectWhitelist {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
async create(body, options) {
|
|
48
|
-
const
|
|
50
|
+
const urlparams = new URLSearchParams(options);
|
|
51
|
+
const queryString = urlparams.toString();
|
|
49
52
|
const response = (
|
|
50
53
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/whitelist?${queryString}`, {
|
|
51
54
|
"method": "POST",
|
package/src/user.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const qs = require("qs");
|
|
2
|
-
|
|
3
1
|
class User {
|
|
4
2
|
|
|
5
3
|
constructor(client, baseUrl, projectId) {
|
|
@@ -9,7 +7,8 @@ class User {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
async get(username, options) {
|
|
12
|
-
const
|
|
10
|
+
const urlparams = new URLSearchParams(options);
|
|
11
|
+
const queryString = urlparams.toString();
|
|
13
12
|
const response = (
|
|
14
13
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/databaseUsers/admin/${username}?${queryString}`)
|
|
15
14
|
).json();
|
|
@@ -17,7 +16,8 @@ class User {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async getAll(options) {
|
|
20
|
-
const
|
|
19
|
+
const urlparams = new URLSearchParams(options);
|
|
20
|
+
const queryString = urlparams.toString();
|
|
21
21
|
const response = (
|
|
22
22
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/databaseUsers?${queryString}`)
|
|
23
23
|
).json();
|
|
@@ -25,7 +25,8 @@ class User {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async delete(username, options) {
|
|
28
|
-
const
|
|
28
|
+
const urlparams = new URLSearchParams(options);
|
|
29
|
+
const queryString = urlparams.toString();
|
|
29
30
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/databaseUsers/admin/${username}?${queryString}`, {
|
|
30
31
|
"method": "DELETE"
|
|
31
32
|
});
|
|
@@ -33,7 +34,8 @@ class User {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
async update(username, body, options) {
|
|
36
|
-
const
|
|
37
|
+
const urlparams = new URLSearchParams(options);
|
|
38
|
+
const queryString = urlparams.toString();
|
|
37
39
|
const response = (
|
|
38
40
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/databaseUsers/admin/${username}?${queryString}`, {
|
|
39
41
|
"method": "PATCH",
|
|
@@ -45,7 +47,8 @@ class User {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
async create(body, options) {
|
|
48
|
-
const
|
|
50
|
+
const urlparams = new URLSearchParams(options);
|
|
51
|
+
const queryString = urlparams.toString();
|
|
49
52
|
const response = (
|
|
50
53
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/databaseUsers?${queryString}`, {
|
|
51
54
|
"method": "POST",
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const {describe, it} = exports.lab = require("@hapi/lab").script();
|
|
2
|
+
const {expect} = require("@hapi/code");
|
|
3
|
+
const nock = require("nock");
|
|
4
|
+
const getClient = require("../src");
|
|
5
|
+
|
|
6
|
+
const baseUrl = "http://dummyBaseUrl";
|
|
7
|
+
const projectId = "dummyProjectId";
|
|
8
|
+
|
|
9
|
+
const client = getClient({
|
|
10
|
+
"publicKey": "dummuyPublicKey",
|
|
11
|
+
"privateKey": "dummyPrivateKey",
|
|
12
|
+
"baseUrl": baseUrl,
|
|
13
|
+
"projectId": projectId
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe("Mongo Atlas Api Client - atlasSearch", () => {
|
|
17
|
+
|
|
18
|
+
describe("When atlasSearch is exported from index", () => {
|
|
19
|
+
it("should export atlasSearch functions", async () => {
|
|
20
|
+
expect(client.atlasSearch.get).to.be.function();
|
|
21
|
+
expect(client.atlasSearch.getAll).to.be.function();
|
|
22
|
+
expect(client.atlasSearch.create).to.be.function();
|
|
23
|
+
expect(client.atlasSearch.delete).to.be.function();
|
|
24
|
+
expect(client.atlasSearch.update).to.be.function();
|
|
25
|
+
expect(client.atlasSearch.getAllAnalyzers).to.be.function();
|
|
26
|
+
expect(client.atlasSearch.upsertAnalyzer).to.be.function();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("When get is called with querystring parameters", () => {
|
|
31
|
+
it("should return response", async () => {
|
|
32
|
+
const expectedRequest = nock(baseUrl)
|
|
33
|
+
.get(`/groups/${projectId}/clusters/mycluster/fts/indexes/myindexId?key1=value1&key2=value2`)
|
|
34
|
+
.reply(200, {"atlasSearch": "name"});
|
|
35
|
+
const result = await client.atlasSearch.get("mycluster", "myindexId", {"key1": "value1", "key2": "value2"});
|
|
36
|
+
expect(result).to.equal({"atlasSearch": "name"});
|
|
37
|
+
expect(expectedRequest.isDone()).to.be.true();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe("When getAll is called with querystring parameters", () => {
|
|
42
|
+
it("should return response", async () => {
|
|
43
|
+
const expectedRequest = nock(baseUrl)
|
|
44
|
+
.get(`/groups/${projectId}/clusters/mycluster/fts/indexes/mydatabasename/mycollectionname?key1=value1&key2=value2`)
|
|
45
|
+
.reply(200, [{"atlasSearch": "name"}]);
|
|
46
|
+
const result = await client.atlasSearch.getAll("mycluster", "mydatabasename", "mycollectionname", {"key1": "value1", "key2": "value2"});
|
|
47
|
+
expect(result).to.equal([{"atlasSearch": "name"}]);
|
|
48
|
+
expect(expectedRequest.isDone()).to.be.true();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("When getAllAnalyzers is called with querystring parameters", () => {
|
|
53
|
+
it("should return response", async () => {
|
|
54
|
+
const expectedRequest = nock(baseUrl)
|
|
55
|
+
.get(`/groups/${projectId}/clusters/mycluster/fts/analyzers?key1=value1&key2=value2`)
|
|
56
|
+
.reply(200, [{"atlasSearch": "name"}]);
|
|
57
|
+
const result = await client.atlasSearch.getAllAnalyzers("mycluster", {"key1": "value1", "key2": "value2"});
|
|
58
|
+
expect(result).to.equal([{"atlasSearch": "name"}]);
|
|
59
|
+
expect(expectedRequest.isDone()).to.be.true();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe("When update is called with querystring parameters", () => {
|
|
64
|
+
it("should return response", async () => {
|
|
65
|
+
const expectedRequest = nock(baseUrl)
|
|
66
|
+
.patch(`/groups/${projectId}/clusters/mycluster/fts/indexes/indexId?key1=value1&key2=value2`)
|
|
67
|
+
.reply(200, [{"atlasSearch": "name"}]);
|
|
68
|
+
const result = await client.atlasSearch.update("mycluster", "indexId", {"body": "value"}, {"key1": "value1", "key2": "value2"});
|
|
69
|
+
expect(result).to.equal([{"atlasSearch": "name"}]);
|
|
70
|
+
expect(expectedRequest.isDone()).to.be.true();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("When upsertAnalyzer is called with querystring parameters", () => {
|
|
75
|
+
it("should return response", async () => {
|
|
76
|
+
const expectedRequest = nock(baseUrl)
|
|
77
|
+
.put(`/groups/${projectId}/clusters/mycluster/fts/analyzers?key1=value1&key2=value2`)
|
|
78
|
+
.reply(200, [{"atlasSearch": "name"}]);
|
|
79
|
+
const result = await client.atlasSearch.upsertAnalyzer("mycluster", {"body": "value"}, {"key1": "value1", "key2": "value2"});
|
|
80
|
+
expect(result).to.equal([{"atlasSearch": "name"}]);
|
|
81
|
+
expect(expectedRequest.isDone()).to.be.true();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe("When create is called with querystring parameters", () => {
|
|
86
|
+
it("should return response", async () => {
|
|
87
|
+
const expectedRequest = nock(baseUrl)
|
|
88
|
+
.post(`/groups/${projectId}/clusters/mycluster/fts/indexes?key1=value1&key2=value2`)
|
|
89
|
+
.reply(200, [{"atlasSearch": "name"}]);
|
|
90
|
+
const result = await client.atlasSearch.create("mycluster", {"body": "value"}, {"key1": "value1", "key2": "value2"});
|
|
91
|
+
expect(result).to.equal([{"atlasSearch": "name"}]);
|
|
92
|
+
expect(expectedRequest.isDone()).to.be.true();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe("When delete is called with querystring parameters", () => {
|
|
97
|
+
it("should return response", async () => {
|
|
98
|
+
const expectedRequest = nock(baseUrl)
|
|
99
|
+
.delete(`/groups/${projectId}/clusters/mycluster/fts/indexes/indexId?key1=value1&key2=value2`)
|
|
100
|
+
.reply(200, true);
|
|
101
|
+
const result = await client.atlasSearch.delete("mycluster", "indexId", {"key1": "value1", "key2": "value2"});
|
|
102
|
+
expect(result).to.be.true();
|
|
103
|
+
expect(expectedRequest.isDone()).to.be.true();
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
});
|