@mongodb-js/mcp-atlas-api-client 3.0.0-prerelease.1
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/dist/apiClient.d.ts +151 -0
- package/dist/apiClient.d.ts.map +1 -0
- package/dist/apiClient.js +636 -0
- package/dist/apiClient.js.map +1 -0
- package/dist/apiClientError.d.ts +11 -0
- package/dist/apiClientError.d.ts.map +1 -0
- package/dist/apiClientError.js +50 -0
- package/dist/apiClientError.js.map +1 -0
- package/dist/auth/authProvider.d.ts +30 -0
- package/dist/auth/authProvider.d.ts.map +1 -0
- package/dist/auth/authProvider.js +16 -0
- package/dist/auth/authProvider.js.map +1 -0
- package/dist/auth/clientCredentials.d.ts +26 -0
- package/dist/auth/clientCredentials.d.ts.map +1 -0
- package/dist/auth/clientCredentials.js +101 -0
- package/dist/auth/clientCredentials.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.d.ts.map +1 -0
- package/dist/openapi.js +2 -0
- package/dist/openapi.js.map +1 -0
- package/dist/userAgentFromServerMetadata.d.ts +3 -0
- package/dist/userAgentFromServerMetadata.d.ts.map +1 -0
- package/dist/userAgentFromServerMetadata.js +4 -0
- package/dist/userAgentFromServerMetadata.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
import createClient from "openapi-fetch";
|
|
2
|
+
import { ApiClientError } from "./apiClientError.js";
|
|
3
|
+
import { AuthProviderFactory } from "./auth/authProvider.js";
|
|
4
|
+
const ATLAS_API_VERSION = "2025-03-12";
|
|
5
|
+
const DEFAULT_SEND_TIMEOUT_MS = 5000;
|
|
6
|
+
/**
|
|
7
|
+
* Allowlist of incoming MCP request header names that may be forwarded to outgoing
|
|
8
|
+
* Atlas API requests. Kept intentionally minimal to avoid propagating hop-by-hop
|
|
9
|
+
* headers (e.g. `host`, `content-length`), cookies, or other sensitive/irrelevant
|
|
10
|
+
* headers. Comparison is case-insensitive, so entries must be lowercase.
|
|
11
|
+
*/
|
|
12
|
+
const FORWARDABLE_REQUEST_HEADERS = new Set(["x-request-id"]);
|
|
13
|
+
/** @public */
|
|
14
|
+
export const defaultCreateApiClient = (options, logger) => {
|
|
15
|
+
return new ApiClient(options, logger);
|
|
16
|
+
};
|
|
17
|
+
export class ApiClient {
|
|
18
|
+
isAuthConfigured() {
|
|
19
|
+
return !!this.authProvider;
|
|
20
|
+
}
|
|
21
|
+
constructor(options, logger, authProvider) {
|
|
22
|
+
this.logger = logger;
|
|
23
|
+
this.options = {
|
|
24
|
+
baseUrl: options.baseUrl,
|
|
25
|
+
userAgent: options.userAgent,
|
|
26
|
+
supportsCurrentIpLookup: options.supportsCurrentIpLookup ?? true,
|
|
27
|
+
};
|
|
28
|
+
this.authProvider =
|
|
29
|
+
authProvider ??
|
|
30
|
+
AuthProviderFactory.create({
|
|
31
|
+
apiBaseUrl: this.options.baseUrl,
|
|
32
|
+
userAgent: this.options.userAgent,
|
|
33
|
+
credentials: options.credentials ?? {},
|
|
34
|
+
httpClient: options.httpClient,
|
|
35
|
+
}, logger);
|
|
36
|
+
this.client = createClient({
|
|
37
|
+
baseUrl: this.options.baseUrl,
|
|
38
|
+
headers: {
|
|
39
|
+
"User-Agent": this.options.userAgent,
|
|
40
|
+
Accept: `application/vnd.atlas.${ATLAS_API_VERSION}+json`,
|
|
41
|
+
},
|
|
42
|
+
fetch: options.httpClient.fetch,
|
|
43
|
+
Request: options.httpClient.Request,
|
|
44
|
+
});
|
|
45
|
+
if (this.authProvider) {
|
|
46
|
+
this.client.use(this.createAuthMiddleware());
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
createAuthMiddleware() {
|
|
50
|
+
return {
|
|
51
|
+
onRequest: async ({ request, schemaPath }) => {
|
|
52
|
+
if (schemaPath.startsWith("/api/private/unauth") || schemaPath.startsWith("/api/oauth")) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const authHeaders = (await this.authProvider?.getAuthHeaders()) ?? {};
|
|
57
|
+
for (const [key, value] of Object.entries(authHeaders)) {
|
|
58
|
+
request.headers.set(key, value);
|
|
59
|
+
}
|
|
60
|
+
return request;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// ignore not available tokens, API will return 401
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async validateAuthConfig() {
|
|
70
|
+
await this.authProvider?.validate();
|
|
71
|
+
}
|
|
72
|
+
async close() {
|
|
73
|
+
await this.authProvider?.revoke();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Merges allowlisted headers from an optional `ApiClientRequestContext` into the
|
|
77
|
+
* provided request options. Only headers in `FORWARDABLE_REQUEST_HEADERS` with a
|
|
78
|
+
* string value are forwarded (e.g. `x-request-id`); all other incoming headers are
|
|
79
|
+
* ignored. Headers already present in `options` take precedence over those coming
|
|
80
|
+
* from the context. Used by the auto-generated Atlas API methods.
|
|
81
|
+
*/
|
|
82
|
+
applyRequestContext(options, context) {
|
|
83
|
+
const contextHeaders = context?.requestInfo?.headers;
|
|
84
|
+
if (!contextHeaders) {
|
|
85
|
+
return options;
|
|
86
|
+
}
|
|
87
|
+
const forwardedHeaders = {};
|
|
88
|
+
for (const [name, value] of Object.entries(contextHeaders)) {
|
|
89
|
+
if (typeof value === "string" && FORWARDABLE_REQUEST_HEADERS.has(name.toLowerCase())) {
|
|
90
|
+
forwardedHeaders[name] = value;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (Object.keys(forwardedHeaders).length === 0) {
|
|
94
|
+
return options;
|
|
95
|
+
}
|
|
96
|
+
const existingHeaders = options?.headers;
|
|
97
|
+
return {
|
|
98
|
+
...options,
|
|
99
|
+
headers: { ...forwardedHeaders, ...existingHeaders },
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
get supportsCurrentIpLookup() {
|
|
103
|
+
return this.options.supportsCurrentIpLookup;
|
|
104
|
+
}
|
|
105
|
+
async getIpInfo() {
|
|
106
|
+
if (!this.supportsCurrentIpLookup) {
|
|
107
|
+
throw new Error("This deployment does not support current IP detection. Provide the IP addresses to allow explicitly.");
|
|
108
|
+
}
|
|
109
|
+
const authHeaders = (await this.authProvider?.getAuthHeaders()) ?? {};
|
|
110
|
+
const endpoint = "api/private/ipinfo";
|
|
111
|
+
const url = new URL(endpoint, this.options.baseUrl);
|
|
112
|
+
const response = await fetch(url, {
|
|
113
|
+
method: "GET",
|
|
114
|
+
headers: {
|
|
115
|
+
...authHeaders,
|
|
116
|
+
Accept: "application/json",
|
|
117
|
+
"User-Agent": this.options.userAgent,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
if (!response.ok) {
|
|
121
|
+
throw await ApiClientError.fromResponse(response);
|
|
122
|
+
}
|
|
123
|
+
return (await response.json());
|
|
124
|
+
}
|
|
125
|
+
async sendEvents(events, { signal = AbortSignal.timeout(DEFAULT_SEND_TIMEOUT_MS) } = {}) {
|
|
126
|
+
if (!this.authProvider) {
|
|
127
|
+
await this.sendUnauthEvents(events, signal);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
await this.sendAuthEvents(events, signal);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if (error instanceof ApiClientError) {
|
|
135
|
+
if (error.response.status !== 401) {
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// send unauth events if any of the following are true:
|
|
140
|
+
// 1: the token is not valid (not ApiClientError)
|
|
141
|
+
// 2: if the api responded with 401 (ApiClientError with status 401)
|
|
142
|
+
await this.sendUnauthEvents(events, signal);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async sendAuthEvents(events, signal) {
|
|
146
|
+
const authHeaders = await this.authProvider?.getAuthHeaders();
|
|
147
|
+
if (!authHeaders) {
|
|
148
|
+
throw new Error("No access token available");
|
|
149
|
+
}
|
|
150
|
+
const authUrl = new URL("api/private/v1.0/telemetry/events", this.options.baseUrl);
|
|
151
|
+
const response = await fetch(authUrl, {
|
|
152
|
+
method: "POST",
|
|
153
|
+
headers: {
|
|
154
|
+
...authHeaders,
|
|
155
|
+
Accept: "application/json",
|
|
156
|
+
"Content-Type": "application/json",
|
|
157
|
+
"User-Agent": this.options.userAgent,
|
|
158
|
+
},
|
|
159
|
+
body: JSON.stringify(events),
|
|
160
|
+
signal,
|
|
161
|
+
});
|
|
162
|
+
if (!response.ok) {
|
|
163
|
+
throw await ApiClientError.fromResponse(response);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async sendUnauthEvents(events, signal) {
|
|
167
|
+
const headers = {
|
|
168
|
+
Accept: "application/json",
|
|
169
|
+
"Content-Type": "application/json",
|
|
170
|
+
"User-Agent": this.options.userAgent,
|
|
171
|
+
};
|
|
172
|
+
const unauthUrl = new URL("api/private/unauth/telemetry/events", this.options.baseUrl);
|
|
173
|
+
const response = await fetch(unauthUrl, {
|
|
174
|
+
method: "POST",
|
|
175
|
+
headers,
|
|
176
|
+
body: JSON.stringify(events),
|
|
177
|
+
signal,
|
|
178
|
+
});
|
|
179
|
+
if (!response.ok) {
|
|
180
|
+
throw await ApiClientError.fromResponse(response);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// DO NOT EDIT. This is auto-generated code.
|
|
184
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
185
|
+
async listClusterDetails(options, context) {
|
|
186
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/clusters", this.applyRequestContext(options, context));
|
|
187
|
+
if (error) {
|
|
188
|
+
throw ApiClientError.fromError(response, error);
|
|
189
|
+
}
|
|
190
|
+
return data;
|
|
191
|
+
}
|
|
192
|
+
async listGroups(options, context) {
|
|
193
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups", this.applyRequestContext(options, context));
|
|
194
|
+
if (error) {
|
|
195
|
+
throw ApiClientError.fromError(response, error);
|
|
196
|
+
}
|
|
197
|
+
return data;
|
|
198
|
+
}
|
|
199
|
+
async createGroup(options, context) {
|
|
200
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups", this.applyRequestContext(options, context));
|
|
201
|
+
if (error) {
|
|
202
|
+
throw ApiClientError.fromError(response, error);
|
|
203
|
+
}
|
|
204
|
+
return data;
|
|
205
|
+
}
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
207
|
+
async deleteGroup(options, context) {
|
|
208
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}", this.applyRequestContext(options, context));
|
|
209
|
+
if (error) {
|
|
210
|
+
throw ApiClientError.fromError(response, error);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
async getGroup(options, context) {
|
|
214
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}", this.applyRequestContext(options, context));
|
|
215
|
+
if (error) {
|
|
216
|
+
throw ApiClientError.fromError(response, error);
|
|
217
|
+
}
|
|
218
|
+
return data;
|
|
219
|
+
}
|
|
220
|
+
async listAccessListEntries(options, context) {
|
|
221
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/accessList", this.applyRequestContext(options, context));
|
|
222
|
+
if (error) {
|
|
223
|
+
throw ApiClientError.fromError(response, error);
|
|
224
|
+
}
|
|
225
|
+
return data;
|
|
226
|
+
}
|
|
227
|
+
async createAccessListEntry(options, context) {
|
|
228
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/accessList", this.applyRequestContext(options, context));
|
|
229
|
+
if (error) {
|
|
230
|
+
throw ApiClientError.fromError(response, error);
|
|
231
|
+
}
|
|
232
|
+
return data;
|
|
233
|
+
}
|
|
234
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
235
|
+
async deleteAccessListEntry(options, context) {
|
|
236
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}/accessList/{entryValue}", this.applyRequestContext(options, context));
|
|
237
|
+
if (error) {
|
|
238
|
+
throw ApiClientError.fromError(response, error);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
async listAlerts(options, context) {
|
|
242
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/alerts", this.applyRequestContext(options, context));
|
|
243
|
+
if (error) {
|
|
244
|
+
throw ApiClientError.fromError(response, error);
|
|
245
|
+
}
|
|
246
|
+
return data;
|
|
247
|
+
}
|
|
248
|
+
async createCloudProviderAccess(options, context) {
|
|
249
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/cloudProviderAccess", this.applyRequestContext(options, context));
|
|
250
|
+
if (error) {
|
|
251
|
+
throw ApiClientError.fromError(response, error);
|
|
252
|
+
}
|
|
253
|
+
return data;
|
|
254
|
+
}
|
|
255
|
+
async authorizeProviderAccessRole(options, context) {
|
|
256
|
+
const { data, error, response } = await this.client.PATCH("/api/atlas/v2/groups/{groupId}/cloudProviderAccess/{roleId}", this.applyRequestContext(options, context));
|
|
257
|
+
if (error) {
|
|
258
|
+
throw ApiClientError.fromError(response, error);
|
|
259
|
+
}
|
|
260
|
+
return data;
|
|
261
|
+
}
|
|
262
|
+
async listClusters(options, context) {
|
|
263
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/clusters", this.applyRequestContext(options, context));
|
|
264
|
+
if (error) {
|
|
265
|
+
throw ApiClientError.fromError(response, error);
|
|
266
|
+
}
|
|
267
|
+
return data;
|
|
268
|
+
}
|
|
269
|
+
async createCluster(options, context) {
|
|
270
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/clusters", this.applyRequestContext(options, context));
|
|
271
|
+
if (error) {
|
|
272
|
+
throw ApiClientError.fromError(response, error);
|
|
273
|
+
}
|
|
274
|
+
return data;
|
|
275
|
+
}
|
|
276
|
+
async upgradeTenantUpgrade(options, context) {
|
|
277
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/clusters/tenantUpgrade", this.applyRequestContext({ ...options, headers: { Accept: "application/vnd.atlas.2023-01-01+json", ...options?.headers } }, context));
|
|
278
|
+
if (error) {
|
|
279
|
+
throw ApiClientError.fromError(response, error);
|
|
280
|
+
}
|
|
281
|
+
return data;
|
|
282
|
+
}
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
284
|
+
async deleteCluster(options, context) {
|
|
285
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}/clusters/{clusterName}", this.applyRequestContext(options, context));
|
|
286
|
+
if (error) {
|
|
287
|
+
throw ApiClientError.fromError(response, error);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
async getCluster(options, context) {
|
|
291
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/clusters/{clusterName}", this.applyRequestContext(options, context));
|
|
292
|
+
if (error) {
|
|
293
|
+
throw ApiClientError.fromError(response, error);
|
|
294
|
+
}
|
|
295
|
+
return data;
|
|
296
|
+
}
|
|
297
|
+
async updateCluster(options, context) {
|
|
298
|
+
const { data, error, response } = await this.client.PATCH("/api/atlas/v2/groups/{groupId}/clusters/{clusterName}", this.applyRequestContext(options, context));
|
|
299
|
+
if (error) {
|
|
300
|
+
throw ApiClientError.fromError(response, error);
|
|
301
|
+
}
|
|
302
|
+
return data;
|
|
303
|
+
}
|
|
304
|
+
async listDropIndexSuggestions(options, context) {
|
|
305
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/performanceAdvisor/dropIndexSuggestions", this.applyRequestContext(options, context));
|
|
306
|
+
if (error) {
|
|
307
|
+
throw ApiClientError.fromError(response, error);
|
|
308
|
+
}
|
|
309
|
+
return data;
|
|
310
|
+
}
|
|
311
|
+
async listSchemaAdvice(options, context) {
|
|
312
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/performanceAdvisor/schemaAdvice", this.applyRequestContext(options, context));
|
|
313
|
+
if (error) {
|
|
314
|
+
throw ApiClientError.fromError(response, error);
|
|
315
|
+
}
|
|
316
|
+
return data;
|
|
317
|
+
}
|
|
318
|
+
async listClusterSuggestedIndexes(options, context) {
|
|
319
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/performanceAdvisor/suggestedIndexes", this.applyRequestContext(options, context));
|
|
320
|
+
if (error) {
|
|
321
|
+
throw ApiClientError.fromError(response, error);
|
|
322
|
+
}
|
|
323
|
+
return data;
|
|
324
|
+
}
|
|
325
|
+
async listDatabaseUsers(options, context) {
|
|
326
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/databaseUsers", this.applyRequestContext(options, context));
|
|
327
|
+
if (error) {
|
|
328
|
+
throw ApiClientError.fromError(response, error);
|
|
329
|
+
}
|
|
330
|
+
return data;
|
|
331
|
+
}
|
|
332
|
+
async createDatabaseUser(options, context) {
|
|
333
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/databaseUsers", this.applyRequestContext(options, context));
|
|
334
|
+
if (error) {
|
|
335
|
+
throw ApiClientError.fromError(response, error);
|
|
336
|
+
}
|
|
337
|
+
return data;
|
|
338
|
+
}
|
|
339
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
340
|
+
async deleteDatabaseUser(options, context) {
|
|
341
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}/databaseUsers/{databaseName}/{username}", this.applyRequestContext(options, context));
|
|
342
|
+
if (error) {
|
|
343
|
+
throw ApiClientError.fromError(response, error);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
async getEncryptionAtRest(options, context) {
|
|
347
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/encryptionAtRest", this.applyRequestContext(options, context));
|
|
348
|
+
if (error) {
|
|
349
|
+
throw ApiClientError.fromError(response, error);
|
|
350
|
+
}
|
|
351
|
+
return data;
|
|
352
|
+
}
|
|
353
|
+
async updateEncryptionAtRest(options, context) {
|
|
354
|
+
const { data, error, response } = await this.client.PATCH("/api/atlas/v2/groups/{groupId}/encryptionAtRest", this.applyRequestContext(options, context));
|
|
355
|
+
if (error) {
|
|
356
|
+
throw ApiClientError.fromError(response, error);
|
|
357
|
+
}
|
|
358
|
+
return data;
|
|
359
|
+
}
|
|
360
|
+
async listFlexClusters(options, context) {
|
|
361
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/flexClusters", this.applyRequestContext(options, context));
|
|
362
|
+
if (error) {
|
|
363
|
+
throw ApiClientError.fromError(response, error);
|
|
364
|
+
}
|
|
365
|
+
return data;
|
|
366
|
+
}
|
|
367
|
+
async createFlexCluster(options, context) {
|
|
368
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/flexClusters", this.applyRequestContext(options, context));
|
|
369
|
+
if (error) {
|
|
370
|
+
throw ApiClientError.fromError(response, error);
|
|
371
|
+
}
|
|
372
|
+
return data;
|
|
373
|
+
}
|
|
374
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
375
|
+
async deleteFlexCluster(options, context) {
|
|
376
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}/flexClusters/{name}", this.applyRequestContext(options, context));
|
|
377
|
+
if (error) {
|
|
378
|
+
throw ApiClientError.fromError(response, error);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
async getFlexCluster(options, context) {
|
|
382
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/flexClusters/{name}", this.applyRequestContext(options, context));
|
|
383
|
+
if (error) {
|
|
384
|
+
throw ApiClientError.fromError(response, error);
|
|
385
|
+
}
|
|
386
|
+
return data;
|
|
387
|
+
}
|
|
388
|
+
async tenantUpgrade(options, context) {
|
|
389
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/flexClusters:tenantUpgrade", this.applyRequestContext(options, context));
|
|
390
|
+
if (error) {
|
|
391
|
+
throw ApiClientError.fromError(response, error);
|
|
392
|
+
}
|
|
393
|
+
return data;
|
|
394
|
+
}
|
|
395
|
+
async listSlowQueryLogs(options, context) {
|
|
396
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/slowQueryLogs", this.applyRequestContext(options, context));
|
|
397
|
+
if (error) {
|
|
398
|
+
throw ApiClientError.fromError(response, error);
|
|
399
|
+
}
|
|
400
|
+
return data;
|
|
401
|
+
}
|
|
402
|
+
async requestSampleDatasetLoad(options, context) {
|
|
403
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/sampleDatasetLoad/{name}", this.applyRequestContext(options, context));
|
|
404
|
+
if (error) {
|
|
405
|
+
throw ApiClientError.fromError(response, error);
|
|
406
|
+
}
|
|
407
|
+
return data;
|
|
408
|
+
}
|
|
409
|
+
async getSampleDatasetLoad(options, context) {
|
|
410
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/sampleDatasetLoad/{sampleDatasetId}", this.applyRequestContext(options, context));
|
|
411
|
+
if (error) {
|
|
412
|
+
throw ApiClientError.fromError(response, error);
|
|
413
|
+
}
|
|
414
|
+
return data;
|
|
415
|
+
}
|
|
416
|
+
async listStreamWorkspaces(options, context) {
|
|
417
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams", this.applyRequestContext(options, context));
|
|
418
|
+
if (error) {
|
|
419
|
+
throw ApiClientError.fromError(response, error);
|
|
420
|
+
}
|
|
421
|
+
return data;
|
|
422
|
+
}
|
|
423
|
+
async createStreamWorkspace(options, context) {
|
|
424
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams", this.applyRequestContext(options, context));
|
|
425
|
+
if (error) {
|
|
426
|
+
throw ApiClientError.fromError(response, error);
|
|
427
|
+
}
|
|
428
|
+
return data;
|
|
429
|
+
}
|
|
430
|
+
async getAccountDetails(options, context) {
|
|
431
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/accountDetails", this.applyRequestContext(options, context));
|
|
432
|
+
if (error) {
|
|
433
|
+
throw ApiClientError.fromError(response, error);
|
|
434
|
+
}
|
|
435
|
+
return data;
|
|
436
|
+
}
|
|
437
|
+
async listPrivateLinkConnections(options, context) {
|
|
438
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/privateLinkConnections", this.applyRequestContext(options, context));
|
|
439
|
+
if (error) {
|
|
440
|
+
throw ApiClientError.fromError(response, error);
|
|
441
|
+
}
|
|
442
|
+
return data;
|
|
443
|
+
}
|
|
444
|
+
async createPrivateLinkConnection(options, context) {
|
|
445
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams/privateLinkConnections", this.applyRequestContext(options, context));
|
|
446
|
+
if (error) {
|
|
447
|
+
throw ApiClientError.fromError(response, error);
|
|
448
|
+
}
|
|
449
|
+
return data;
|
|
450
|
+
}
|
|
451
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
452
|
+
async deletePrivateLinkConnection(options, context) {
|
|
453
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}/streams/privateLinkConnections/{connectionId}", this.applyRequestContext(options, context));
|
|
454
|
+
if (error) {
|
|
455
|
+
throw ApiClientError.fromError(response, error);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
async getPrivateLinkConnection(options, context) {
|
|
459
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/privateLinkConnections/{connectionId}", this.applyRequestContext(options, context));
|
|
460
|
+
if (error) {
|
|
461
|
+
throw ApiClientError.fromError(response, error);
|
|
462
|
+
}
|
|
463
|
+
return data;
|
|
464
|
+
}
|
|
465
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
466
|
+
async deleteVpcPeeringConnection(options, context) {
|
|
467
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}/streams/vpcPeeringConnections/{id}", this.applyRequestContext(options, context));
|
|
468
|
+
if (error) {
|
|
469
|
+
throw ApiClientError.fromError(response, error);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
473
|
+
async acceptVpcPeeringConnection(options, context) {
|
|
474
|
+
const { error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams/vpcPeeringConnections/{id}:accept", this.applyRequestContext(options, context));
|
|
475
|
+
if (error) {
|
|
476
|
+
throw ApiClientError.fromError(response, error);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
480
|
+
async rejectVpcPeeringConnection(options, context) {
|
|
481
|
+
const { error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams/vpcPeeringConnections/{id}:reject", this.applyRequestContext(options, context));
|
|
482
|
+
if (error) {
|
|
483
|
+
throw ApiClientError.fromError(response, error);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
487
|
+
async deleteStreamWorkspace(options, context) {
|
|
488
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}/streams/{tenantName}", this.applyRequestContext(options, context));
|
|
489
|
+
if (error) {
|
|
490
|
+
throw ApiClientError.fromError(response, error);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
async getStreamWorkspace(options, context) {
|
|
494
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/{tenantName}", this.applyRequestContext(options, context));
|
|
495
|
+
if (error) {
|
|
496
|
+
throw ApiClientError.fromError(response, error);
|
|
497
|
+
}
|
|
498
|
+
return data;
|
|
499
|
+
}
|
|
500
|
+
async updateStreamWorkspace(options, context) {
|
|
501
|
+
const { data, error, response } = await this.client.PATCH("/api/atlas/v2/groups/{groupId}/streams/{tenantName}", this.applyRequestContext(options, context));
|
|
502
|
+
if (error) {
|
|
503
|
+
throw ApiClientError.fromError(response, error);
|
|
504
|
+
}
|
|
505
|
+
return data;
|
|
506
|
+
}
|
|
507
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
508
|
+
async downloadAuditLogs(options, context) {
|
|
509
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/auditLogs", this.applyRequestContext({ ...options, headers: { Accept: "application/vnd.atlas.2023-02-01+gzip", ...options?.headers } }, context));
|
|
510
|
+
if (error) {
|
|
511
|
+
throw ApiClientError.fromError(response, error);
|
|
512
|
+
}
|
|
513
|
+
return data;
|
|
514
|
+
}
|
|
515
|
+
async listStreamConnections(options, context) {
|
|
516
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections", this.applyRequestContext(options, context));
|
|
517
|
+
if (error) {
|
|
518
|
+
throw ApiClientError.fromError(response, error);
|
|
519
|
+
}
|
|
520
|
+
return data;
|
|
521
|
+
}
|
|
522
|
+
async createStreamConnection(options, context) {
|
|
523
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections", this.applyRequestContext(options, context));
|
|
524
|
+
if (error) {
|
|
525
|
+
throw ApiClientError.fromError(response, error);
|
|
526
|
+
}
|
|
527
|
+
return data;
|
|
528
|
+
}
|
|
529
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
530
|
+
async deleteStreamConnection(options, context) {
|
|
531
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}", this.applyRequestContext(options, context));
|
|
532
|
+
if (error) {
|
|
533
|
+
throw ApiClientError.fromError(response, error);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
async getStreamConnection(options, context) {
|
|
537
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}", this.applyRequestContext(options, context));
|
|
538
|
+
if (error) {
|
|
539
|
+
throw ApiClientError.fromError(response, error);
|
|
540
|
+
}
|
|
541
|
+
return data;
|
|
542
|
+
}
|
|
543
|
+
async updateStreamConnection(options, context) {
|
|
544
|
+
const { data, error, response } = await this.client.PATCH("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}", this.applyRequestContext(options, context));
|
|
545
|
+
if (error) {
|
|
546
|
+
throw ApiClientError.fromError(response, error);
|
|
547
|
+
}
|
|
548
|
+
return data;
|
|
549
|
+
}
|
|
550
|
+
async createStreamProcessor(options, context) {
|
|
551
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor", this.applyRequestContext(options, context));
|
|
552
|
+
if (error) {
|
|
553
|
+
throw ApiClientError.fromError(response, error);
|
|
554
|
+
}
|
|
555
|
+
return data;
|
|
556
|
+
}
|
|
557
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
558
|
+
async deleteStreamProcessor(options, context) {
|
|
559
|
+
const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}", this.applyRequestContext(options, context));
|
|
560
|
+
if (error) {
|
|
561
|
+
throw ApiClientError.fromError(response, error);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
async getStreamProcessor(options, context) {
|
|
565
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}", this.applyRequestContext(options, context));
|
|
566
|
+
if (error) {
|
|
567
|
+
throw ApiClientError.fromError(response, error);
|
|
568
|
+
}
|
|
569
|
+
return data;
|
|
570
|
+
}
|
|
571
|
+
async updateStreamProcessor(options, context) {
|
|
572
|
+
const { data, error, response } = await this.client.PATCH("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}", this.applyRequestContext(options, context));
|
|
573
|
+
if (error) {
|
|
574
|
+
throw ApiClientError.fromError(response, error);
|
|
575
|
+
}
|
|
576
|
+
return data;
|
|
577
|
+
}
|
|
578
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
579
|
+
async startStreamProcessor(options, context) {
|
|
580
|
+
const { error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}:start", this.applyRequestContext(options, context));
|
|
581
|
+
if (error) {
|
|
582
|
+
throw ApiClientError.fromError(response, error);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
586
|
+
async startStreamProcessorWith(options, context) {
|
|
587
|
+
const { error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}:startWith", this.applyRequestContext(options, context));
|
|
588
|
+
if (error) {
|
|
589
|
+
throw ApiClientError.fromError(response, error);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
593
|
+
async stopStreamProcessor(options, context) {
|
|
594
|
+
const { error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}:stop", this.applyRequestContext(options, context));
|
|
595
|
+
if (error) {
|
|
596
|
+
throw ApiClientError.fromError(response, error);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
async getStreamProcessors(options, context) {
|
|
600
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processors", this.applyRequestContext(options, context));
|
|
601
|
+
if (error) {
|
|
602
|
+
throw ApiClientError.fromError(response, error);
|
|
603
|
+
}
|
|
604
|
+
return data;
|
|
605
|
+
}
|
|
606
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
607
|
+
async downloadOperationalLogs(options, context) {
|
|
608
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams/{tenantName}:downloadOperationalLogs", this.applyRequestContext({ ...options, headers: { Accept: "application/vnd.atlas.2025-03-12+gzip", ...options?.headers } }, context));
|
|
609
|
+
if (error) {
|
|
610
|
+
throw ApiClientError.fromError(response, error);
|
|
611
|
+
}
|
|
612
|
+
return data;
|
|
613
|
+
}
|
|
614
|
+
async withStreamSampleConnections(options, context) {
|
|
615
|
+
const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams:withSampleConnections", this.applyRequestContext(options, context));
|
|
616
|
+
if (error) {
|
|
617
|
+
throw ApiClientError.fromError(response, error);
|
|
618
|
+
}
|
|
619
|
+
return data;
|
|
620
|
+
}
|
|
621
|
+
async listOrgs(options, context) {
|
|
622
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/orgs", this.applyRequestContext(options, context));
|
|
623
|
+
if (error) {
|
|
624
|
+
throw ApiClientError.fromError(response, error);
|
|
625
|
+
}
|
|
626
|
+
return data;
|
|
627
|
+
}
|
|
628
|
+
async getOrgGroups(options, context) {
|
|
629
|
+
const { data, error, response } = await this.client.GET("/api/atlas/v2/orgs/{orgId}/groups", this.applyRequestContext(options, context));
|
|
630
|
+
if (error) {
|
|
631
|
+
throw ApiClientError.fromError(response, error);
|
|
632
|
+
}
|
|
633
|
+
return data;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
//# sourceMappingURL=apiClient.js.map
|