• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb-js / mongodb-mcp-server / 23355872884

20 Mar 2026 05:57PM UTC coverage: 84.726% (+0.03%) from 84.697%
23355872884

push

github

web-flow
fix: remove get-logs action from atlas-streams-discover (#994)

2081 of 2682 branches covered (77.59%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

44 existing lines in 3 files now uncovered.

9895 of 11453 relevant lines covered (86.4%)

110.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

64.0
/src/common/atlas/apiClient.ts
1
import createClient from "openapi-fetch";
3✔
2
import type { ClientOptions, FetchOptions, Client, Middleware } from "openapi-fetch";
3
import { ApiClientError } from "./apiClientError.js";
3✔
4
import type { paths, operations } from "./openapi.js";
5
import type { CommonProperties, TelemetryEvent } from "../../telemetry/types.js";
6
import { packageInfo } from "../packageInfo.js";
3✔
7
import type { LoggerBase } from "../logging/index.js";
8
import { createFetch } from "@mongodb-js/devtools-proxy-support";
3✔
9
import { Request as NodeFetchRequest } from "node-fetch";
3✔
10
import type { Credentials, AuthProvider } from "./auth/authProvider.js";
11
import { AuthProviderFactory } from "./auth/authProvider.js";
3✔
12

13
const ATLAS_API_VERSION = "2025-03-12";
3✔
14
const DEFAULT_SEND_TIMEOUT_MS = 5_000;
3✔
15

16
export interface ApiClientOptions {
17
    baseUrl: string;
18
    userAgent?: string;
19
    credentials?: Credentials;
20
    requestContext?: RequestContext;
21
}
22

23
type RequestContext = {
24
    headers?: Record<string, string | string[] | undefined>;
25
};
26

27
export type ApiClientFactoryFn = (options: ApiClientOptions, logger: LoggerBase) => ApiClient;
28

29
export const defaultCreateApiClient: ApiClientFactoryFn = (options, logger) => {
3✔
30
    return new ApiClient(options, logger);
138✔
31
};
138✔
32

33
export class ApiClient {
3✔
34
    private readonly options: {
35
        baseUrl: string;
36
        userAgent: string;
37
    };
38

39
    private customFetch: typeof fetch;
40

41
    private client: Client<paths>;
42

43
    public isAuthConfigured(): boolean {
3✔
44
        return !!this.authProvider;
3✔
45
    }
3✔
46

47
    constructor(
3✔
48
        options: ApiClientOptions,
155✔
49
        public readonly logger: LoggerBase,
155✔
50
        public readonly authProvider?: AuthProvider
155✔
51
    ) {
155✔
52
        // createFetch assumes that the first parameter of fetch is always a string
53
        // with the URL. However, fetch can also receive a Request object. While
54
        // the typechecking complains, createFetch does passthrough the parameters
55
        // so it works fine. That said, node-fetch has incompatibilities with the web version
56
        // of fetch and can lead to genuine issues so we would like to move away of node-fetch dependency.
57
        this.customFetch = createFetch({
155✔
58
            useEnvironmentVariableProxies: true,
155✔
59
        }) as unknown as typeof fetch;
155✔
60
        this.options = {
155✔
61
            ...options,
155✔
62
            userAgent: options.userAgent ?? `AtlasMCP/${packageInfo.version} (${process.platform}; ${process.arch})`,
155✔
63
        };
155✔
64

65
        this.authProvider =
155✔
66
            authProvider ??
155✔
67
            AuthProviderFactory.create(
155✔
68
                {
155✔
69
                    apiBaseUrl: this.options.baseUrl,
155✔
70
                    userAgent: this.options.userAgent,
155✔
71
                    credentials: options.credentials ?? {},
155!
72
                },
155✔
73
                logger
155✔
74
            );
155✔
75

76
        this.client = createClient<paths>({
155✔
77
            baseUrl: this.options.baseUrl,
155✔
78
            headers: {
155✔
79
                "User-Agent": this.options.userAgent,
155✔
80
                Accept: `application/vnd.atlas.${ATLAS_API_VERSION}+json`,
155✔
81
            },
155✔
82
            fetch: this.customFetch,
155✔
83
            // NodeFetchRequest has more overloadings than the native Request
84
            // so it complains here. However, the interfaces are actually compatible
85
            // so it's not a real problem, just a type checking problem.
86
            Request: NodeFetchRequest as unknown as ClientOptions["Request"],
155✔
87
        });
155✔
88

89
        if (this.authProvider) {
155!
90
            this.client.use(this.createAuthMiddleware());
36✔
91
        }
36✔
92
    }
155✔
93

94
    private createAuthMiddleware(): Middleware {
3✔
95
        return {
36✔
96
            onRequest: async ({ request, schemaPath }): Promise<Request | undefined> => {
36✔
97
                if (schemaPath.startsWith("/api/private/unauth") || schemaPath.startsWith("/api/oauth")) {
221!
98
                    return undefined;
×
99
                }
×
100

101
                try {
221✔
102
                    const authHeaders = (await this.authProvider?.getAuthHeaders()) ?? {};
221!
103
                    for (const [key, value] of Object.entries(authHeaders)) {
221✔
104
                        request.headers.set(key, value);
220✔
105
                    }
220✔
106
                    return request;
221✔
107
                } catch {
221!
108
                    // ignore not available tokens, API will return 401
109
                    return undefined;
×
110
                }
×
111
            },
221✔
112
        };
36✔
113
    }
36✔
114

115
    public async validateAuthConfig(): Promise<void> {
3✔
116
        await this.authProvider?.validate();
31✔
117
    }
31✔
118

119
    public async close(): Promise<void> {
3✔
120
        await this.authProvider?.revoke();
46✔
121
    }
46✔
122

123
    public async getIpInfo(): Promise<{
3✔
124
        currentIpv4Address: string;
125
    }> {
36✔
126
        const authHeaders = (await this.authProvider?.getAuthHeaders()) ?? {};
36!
127

128
        const endpoint = "api/private/ipinfo";
36✔
129
        const url = new URL(endpoint, this.options.baseUrl);
36✔
130
        const response = await fetch(url, {
36✔
131
            method: "GET",
36✔
132
            headers: {
36✔
133
                ...authHeaders,
36✔
134
                Accept: "application/json",
36✔
135
                "User-Agent": this.options.userAgent,
36✔
136
            },
36✔
137
        });
36✔
138

139
        if (!response.ok) {
36!
140
            throw await ApiClientError.fromResponse(response);
2✔
141
        }
2!
142

143
        return (await response.json()) as Promise<{
34✔
144
            currentIpv4Address: string;
145
        }>;
146
    }
36✔
147

148
    public async sendEvents(
3✔
149
        events: TelemetryEvent<CommonProperties>[],
49✔
150
        { signal = AbortSignal.timeout(DEFAULT_SEND_TIMEOUT_MS) }: { signal?: AbortSignal } = {}
49✔
151
    ): Promise<void> {
49✔
152
        if (!this.authProvider) {
49!
153
            await this.sendUnauthEvents(events, signal);
22✔
154
            return;
22✔
155
        }
22✔
156

157
        try {
27✔
158
            await this.sendAuthEvents(events, signal);
27✔
159
        } catch (error) {
29!
160
            if (error instanceof ApiClientError) {
14✔
161
                if (error.response.status !== 401) {
2!
162
                    throw error;
×
163
                }
×
164
            }
2✔
165

166
            // send unauth events if any of the following are true:
167
            // 1: the token is not valid (not ApiClientError)
168
            // 2: if the api responded with 401 (ApiClientError with status 401)
169
            await this.sendUnauthEvents(events, signal);
14✔
170
        }
12✔
171
    }
49✔
172

173
    private async sendAuthEvents(events: TelemetryEvent<CommonProperties>[], signal?: AbortSignal): Promise<void> {
3✔
174
        const authHeaders = await this.authProvider?.getAuthHeaders();
27✔
175
        if (!authHeaders) {
27!
176
            throw new Error("No access token available");
9✔
177
        }
9✔
178
        const authUrl = new URL("api/private/v1.0/telemetry/events", this.options.baseUrl);
15✔
179
        const response = await fetch(authUrl, {
15✔
180
            method: "POST",
15✔
181
            headers: {
15✔
182
                ...authHeaders,
15✔
183
                Accept: "application/json",
15✔
184
                "Content-Type": "application/json",
15✔
185
                "User-Agent": this.options.userAgent,
15✔
186
            },
15✔
187
            body: JSON.stringify(events),
15✔
188
            signal,
15✔
189
        });
15✔
190

191
        if (!response.ok) {
19!
192
            throw await ApiClientError.fromResponse(response);
2✔
193
        }
2✔
194
    }
27✔
195

196
    private async sendUnauthEvents(events: TelemetryEvent<CommonProperties>[], signal?: AbortSignal): Promise<void> {
3✔
197
        const headers: Record<string, string> = {
36✔
198
            Accept: "application/json",
36✔
199
            "Content-Type": "application/json",
36✔
200
            "User-Agent": this.options.userAgent,
36✔
201
        };
36✔
202

203
        const unauthUrl = new URL("api/private/unauth/telemetry/events", this.options.baseUrl);
36✔
204
        const response = await fetch(unauthUrl, {
36✔
205
            method: "POST",
36✔
206
            headers,
36✔
207
            body: JSON.stringify(events),
36✔
208
            signal,
36✔
209
        });
36✔
210

211
        if (!response.ok) {
36✔
212
            throw await ApiClientError.fromResponse(response);
1✔
213
        }
1✔
214
    }
36✔
215

216
    // DO NOT EDIT. This is auto-generated code.
217
    /* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-return */
218
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
219
    async listClusterDetails(options?: FetchOptions<operations["listClusterDetails"]>) {
3✔
220
        const { data, error, response } = await this.client.GET("/api/atlas/v2/clusters", options);
×
221
        if (error) {
×
222
            throw ApiClientError.fromError(response, error);
×
223
        }
×
224
        return data;
×
225
    }
×
226

227
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
228
    async listGroups(options?: FetchOptions<operations["listGroups"]>) {
3✔
229
        const { data, error, response } = await this.client.GET("/api/atlas/v2/groups", options);
4✔
230
        if (error) {
4!
231
            throw ApiClientError.fromError(response, error);
1✔
232
        }
1✔
233
        return data;
3✔
234
    }
4✔
235

236
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
237
    async createGroup(options: FetchOptions<operations["createGroup"]>) {
3✔
238
        const { data, error, response } = await this.client.POST("/api/atlas/v2/groups", options);
12✔
239
        if (error) {
12!
240
            throw ApiClientError.fromError(response, error);
×
241
        }
×
242
        return data;
12✔
243
    }
12✔
244

245
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
246
    async deleteGroup(options: FetchOptions<operations["deleteGroup"]>) {
3✔
247
        const { error, response } = await this.client.DELETE("/api/atlas/v2/groups/{groupId}", options);
12✔
248
        if (error) {
12✔
249
            throw ApiClientError.fromError(response, error);
7✔
250
        }
7✔
251
    }
12✔
252

253
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
254
    async getGroup(options: FetchOptions<operations["getGroup"]>) {
3✔
255
        const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}", options);
1✔
256
        if (error) {
1!
257
            throw ApiClientError.fromError(response, error);
×
258
        }
×
259
        return data;
1✔
260
    }
1✔
261

262
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
263
    async listAccessListEntries(options: FetchOptions<operations["listGroupAccessListEntries"]>) {
3✔
264
        const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/accessList", options);
4✔
265
        if (error) {
4!
266
            throw ApiClientError.fromError(response, error);
×
267
        }
×
268
        return data;
4✔
269
    }
4✔
270

271
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
272
    async createAccessListEntry(options: FetchOptions<operations["createGroupAccessListEntry"]>) {
3✔
273
        const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/accessList", options);
23✔
274
        if (error) {
23!
275
            throw ApiClientError.fromError(response, error);
1✔
276
        }
1!
277
        return data;
22✔
278
    }
23✔
279

280
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
281
    async deleteAccessListEntry(options: FetchOptions<operations["deleteGroupAccessListEntry"]>) {
3✔
282
        const { error, response } = await this.client.DELETE(
5✔
283
            "/api/atlas/v2/groups/{groupId}/accessList/{entryValue}",
5✔
284
            options
5✔
285
        );
5✔
286
        if (error) {
5!
287
            throw ApiClientError.fromError(response, error);
×
288
        }
×
289
    }
5✔
290

291
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
292
    async listAlerts(options: FetchOptions<operations["listGroupAlerts"]>) {
3✔
293
        const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/alerts", options);
1✔
294
        if (error) {
1!
295
            throw ApiClientError.fromError(response, error);
×
296
        }
×
297
        return data;
1✔
298
    }
1✔
299

300
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
301
    async listClusters(options: FetchOptions<operations["listGroupClusters"]>) {
3✔
302
        const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/clusters", options);
1✔
303
        if (error) {
1!
304
            throw ApiClientError.fromError(response, error);
×
305
        }
×
306
        return data;
1✔
307
    }
1✔
308

309
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
310
    async createCluster(options: FetchOptions<operations["createGroupCluster"]>) {
3✔
311
        const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/clusters", options);
7✔
312
        if (error) {
7!
313
            throw ApiClientError.fromError(response, error);
×
314
        }
×
315
        return data;
7✔
316
    }
7✔
317

318
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
319
    async deleteCluster(options: FetchOptions<operations["deleteGroupCluster"]>) {
3✔
320
        const { error, response } = await this.client.DELETE(
7✔
321
            "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}",
7✔
322
            options
7✔
323
        );
7✔
324
        if (error) {
7✔
325
            throw ApiClientError.fromError(response, error);
1✔
326
        }
1✔
327
    }
7✔
328

329
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
330
    async getCluster(options: FetchOptions<operations["getGroupCluster"]>) {
3✔
331
        const { data, error, response } = await this.client.GET(
24✔
332
            "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}",
24✔
333
            options
24✔
334
        );
24✔
335
        if (error) {
24!
336
            throw ApiClientError.fromError(response, error);
×
337
        }
×
338
        return data;
24✔
339
    }
24✔
340

341
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
342
    async listDropIndexSuggestions(
3✔
343
        options: FetchOptions<operations["listGroupClusterPerformanceAdvisorDropIndexSuggestions"]>
×
344
    ) {
×
345
        const { data, error, response } = await this.client.GET(
×
346
            "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/performanceAdvisor/dropIndexSuggestions",
×
347
            options
×
348
        );
×
349
        if (error) {
×
350
            throw ApiClientError.fromError(response, error);
×
351
        }
×
352
        return data;
×
353
    }
×
354

355
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
356
    async listSchemaAdvice(options: FetchOptions<operations["listGroupClusterPerformanceAdvisorSchemaAdvice"]>) {
3✔
357
        const { data, error, response } = await this.client.GET(
×
358
            "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/performanceAdvisor/schemaAdvice",
×
359
            options
×
360
        );
×
361
        if (error) {
×
362
            throw ApiClientError.fromError(response, error);
×
363
        }
×
364
        return data;
×
365
    }
×
366

367
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
368
    async listClusterSuggestedIndexes(
3✔
369
        options: FetchOptions<operations["listGroupClusterPerformanceAdvisorSuggestedIndexes"]>
×
370
    ) {
×
371
        const { data, error, response } = await this.client.GET(
×
372
            "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/performanceAdvisor/suggestedIndexes",
×
373
            options
×
374
        );
×
375
        if (error) {
×
376
            throw ApiClientError.fromError(response, error);
×
377
        }
×
378
        return data;
×
379
    }
×
380

381
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
382
    async listDatabaseUsers(options: FetchOptions<operations["listGroupDatabaseUsers"]>) {
3✔
383
        const { data, error, response } = await this.client.GET(
1✔
384
            "/api/atlas/v2/groups/{groupId}/databaseUsers",
1✔
385
            options
1✔
386
        );
1✔
387
        if (error) {
1!
388
            throw ApiClientError.fromError(response, error);
×
389
        }
×
390
        return data;
1✔
391
    }
1✔
392

393
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
394
    async createDatabaseUser(options: FetchOptions<operations["createGroupDatabaseUser"]>) {
3✔
395
        const { data, error, response } = await this.client.POST(
7✔
396
            "/api/atlas/v2/groups/{groupId}/databaseUsers",
7✔
397
            options
7✔
398
        );
7✔
399
        if (error) {
7!
400
            throw ApiClientError.fromError(response, error);
×
401
        }
×
402
        return data;
7✔
403
    }
7✔
404

405
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
406
    async deleteDatabaseUser(options: FetchOptions<operations["deleteGroupDatabaseUser"]>) {
3✔
407
        const { error, response } = await this.client.DELETE(
9✔
408
            "/api/atlas/v2/groups/{groupId}/databaseUsers/{databaseName}/{username}",
9✔
409
            options
9✔
410
        );
9✔
411
        if (error) {
9✔
412
            throw ApiClientError.fromError(response, error);
2✔
413
        }
2✔
414
    }
9✔
415

416
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
417
    async listFlexClusters(options: FetchOptions<operations["listGroupFlexClusters"]>) {
3✔
418
        const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/flexClusters", options);
×
419
        if (error) {
×
420
            throw ApiClientError.fromError(response, error);
×
421
        }
×
422
        return data;
×
423
    }
×
424

425
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
426
    async createFlexCluster(options: FetchOptions<operations["createGroupFlexCluster"]>) {
3✔
427
        const { data, error, response } = await this.client.POST(
×
428
            "/api/atlas/v2/groups/{groupId}/flexClusters",
×
429
            options
×
430
        );
×
431
        if (error) {
×
432
            throw ApiClientError.fromError(response, error);
×
433
        }
×
434
        return data;
×
435
    }
×
436

437
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
438
    async deleteFlexCluster(options: FetchOptions<operations["deleteGroupFlexCluster"]>) {
3✔
439
        const { error, response } = await this.client.DELETE(
×
440
            "/api/atlas/v2/groups/{groupId}/flexClusters/{name}",
×
441
            options
×
442
        );
×
443
        if (error) {
×
444
            throw ApiClientError.fromError(response, error);
×
445
        }
×
446
    }
×
447

448
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
449
    async getFlexCluster(options: FetchOptions<operations["getGroupFlexCluster"]>) {
3✔
450
        const { data, error, response } = await this.client.GET(
×
451
            "/api/atlas/v2/groups/{groupId}/flexClusters/{name}",
×
452
            options
×
453
        );
×
454
        if (error) {
×
455
            throw ApiClientError.fromError(response, error);
×
456
        }
×
457
        return data;
×
458
    }
×
459

460
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
461
    async listSlowQueryLogs(options: FetchOptions<operations["listGroupProcessPerformanceAdvisorSlowQueryLogs"]>) {
3✔
462
        const { data, error, response } = await this.client.GET(
×
463
            "/api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/slowQueryLogs",
×
464
            options
×
465
        );
×
466
        if (error) {
×
467
            throw ApiClientError.fromError(response, error);
×
468
        }
×
469
        return data;
×
470
    }
×
471

472
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
473
    async listStreamWorkspaces(options: FetchOptions<operations["listGroupStreamWorkspaces"]>) {
3✔
474
        const { data, error, response } = await this.client.GET("/api/atlas/v2/groups/{groupId}/streams", options);
3✔
475
        if (error) {
3!
476
            throw ApiClientError.fromError(response, error);
×
477
        }
×
478
        return data;
3✔
479
    }
3✔
480

481
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
482
    async createStreamWorkspace(options: FetchOptions<operations["createGroupStreamWorkspace"]>) {
3✔
483
        const { data, error, response } = await this.client.POST("/api/atlas/v2/groups/{groupId}/streams", options);
6✔
484
        if (error) {
6!
485
            throw ApiClientError.fromError(response, error);
×
486
        }
×
487
        return data;
6✔
488
    }
6✔
489

490
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
491
    async getAccountDetails(options: FetchOptions<operations["getGroupStreamAccountDetails"]>) {
3✔
492
        const { data, error, response } = await this.client.GET(
×
493
            "/api/atlas/v2/groups/{groupId}/streams/accountDetails",
×
494
            options
×
495
        );
×
496
        if (error) {
×
497
            throw ApiClientError.fromError(response, error);
×
498
        }
×
499
        return data;
×
500
    }
×
501

502
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
503
    async listPrivateLinkConnections(options: FetchOptions<operations["listGroupStreamPrivateLinkConnections"]>) {
3✔
504
        const { data, error, response } = await this.client.GET(
1✔
505
            "/api/atlas/v2/groups/{groupId}/streams/privateLinkConnections",
1✔
506
            options
1✔
507
        );
1✔
508
        if (error) {
1!
509
            throw ApiClientError.fromError(response, error);
×
510
        }
×
511
        return data;
1✔
512
    }
1✔
513

514
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
515
    async createPrivateLinkConnection(options: FetchOptions<operations["createGroupStreamPrivateLinkConnection"]>) {
3✔
516
        const { data, error, response } = await this.client.POST(
×
517
            "/api/atlas/v2/groups/{groupId}/streams/privateLinkConnections",
×
518
            options
×
519
        );
×
520
        if (error) {
×
521
            throw ApiClientError.fromError(response, error);
×
522
        }
×
523
        return data;
×
524
    }
×
525

526
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
527
    async deletePrivateLinkConnection(options: FetchOptions<operations["deleteGroupStreamPrivateLinkConnection"]>) {
3✔
528
        const { error, response } = await this.client.DELETE(
×
529
            "/api/atlas/v2/groups/{groupId}/streams/privateLinkConnections/{connectionId}",
×
530
            options
×
531
        );
×
532
        if (error) {
×
533
            throw ApiClientError.fromError(response, error);
×
534
        }
×
535
    }
×
536

537
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
538
    async getPrivateLinkConnection(options: FetchOptions<operations["getGroupStreamPrivateLinkConnection"]>) {
3✔
539
        const { data, error, response } = await this.client.GET(
×
540
            "/api/atlas/v2/groups/{groupId}/streams/privateLinkConnections/{connectionId}",
×
541
            options
×
542
        );
×
543
        if (error) {
×
544
            throw ApiClientError.fromError(response, error);
×
545
        }
×
546
        return data;
×
547
    }
×
548

549
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
550
    async deleteVpcPeeringConnection(options: FetchOptions<operations["deleteGroupStreamVpcPeeringConnection"]>) {
3✔
551
        const { error, response } = await this.client.DELETE(
×
552
            "/api/atlas/v2/groups/{groupId}/streams/vpcPeeringConnections/{id}",
×
553
            options
×
554
        );
×
555
        if (error) {
×
556
            throw ApiClientError.fromError(response, error);
×
557
        }
×
558
    }
×
559

560
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
561
    async acceptVpcPeeringConnection(options: FetchOptions<operations["acceptGroupStreamVpcPeeringConnection"]>) {
3✔
562
        const { error, response } = await this.client.POST(
×
563
            "/api/atlas/v2/groups/{groupId}/streams/vpcPeeringConnections/{id}:accept",
×
564
            options
×
565
        );
×
566
        if (error) {
×
567
            throw ApiClientError.fromError(response, error);
×
568
        }
×
569
    }
×
570

571
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
572
    async rejectVpcPeeringConnection(options: FetchOptions<operations["rejectGroupStreamVpcPeeringConnection"]>) {
3✔
573
        const { error, response } = await this.client.POST(
×
574
            "/api/atlas/v2/groups/{groupId}/streams/vpcPeeringConnections/{id}:reject",
×
575
            options
×
576
        );
×
577
        if (error) {
×
578
            throw ApiClientError.fromError(response, error);
×
579
        }
×
580
    }
×
581

582
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
583
    async deleteStreamWorkspace(options: FetchOptions<operations["deleteGroupStreamWorkspace"]>) {
3✔
584
        const { error, response } = await this.client.DELETE(
7✔
585
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}",
7✔
586
            options
7✔
587
        );
7✔
588
        if (error) {
7✔
589
            throw ApiClientError.fromError(response, error);
2✔
590
        }
2✔
591
    }
7✔
592

593
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
594
    async getStreamWorkspace(options: FetchOptions<operations["getGroupStreamWorkspace"]>) {
3✔
595
        const { data, error, response } = await this.client.GET(
11✔
596
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}",
11✔
597
            options
11✔
598
        );
11✔
599
        if (error) {
11✔
600
            throw ApiClientError.fromError(response, error);
4✔
601
        }
4✔
602
        return data;
7✔
603
    }
11✔
604

605
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
606
    async updateStreamWorkspace(options: FetchOptions<operations["updateGroupStreamWorkspace"]>) {
3✔
607
        const { data, error, response } = await this.client.PATCH(
2✔
608
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}",
2✔
609
            options
2✔
610
        );
2✔
611
        if (error) {
2!
612
            throw ApiClientError.fromError(response, error);
×
613
        }
×
614
        return data;
2✔
615
    }
2✔
616

617
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
618
    async downloadAuditLogs(options: FetchOptions<operations["downloadGroupStreamAuditLogs"]>) {
3✔
UNCOV
619
        const { data, error, response } = await this.client.GET(
×
UNCOV
620
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/auditLogs",
×
UNCOV
621
            { ...options, headers: { Accept: "application/vnd.atlas.2023-02-01+gzip", ...options?.headers } }
×
UNCOV
622
        );
×
UNCOV
623
        if (error) {
×
624
            throw ApiClientError.fromError(response, error);
×
625
        }
×
UNCOV
626
        return data;
×
UNCOV
627
    }
×
628

629
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
630
    async listStreamConnections(options: FetchOptions<operations["listGroupStreamConnections"]>) {
3✔
631
        const { data, error, response } = await this.client.GET(
6✔
632
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections",
6✔
633
            options
6✔
634
        );
6✔
635
        if (error) {
6!
636
            throw ApiClientError.fromError(response, error);
×
637
        }
×
638
        return data;
6✔
639
    }
6✔
640

641
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
642
    async createStreamConnection(options: FetchOptions<operations["createGroupStreamConnection"]>) {
3✔
643
        const { data, error, response } = await this.client.POST(
16✔
644
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections",
16✔
645
            options
16✔
646
        );
16✔
647
        if (error) {
16!
648
            throw ApiClientError.fromError(response, error);
×
649
        }
×
650
        return data;
16✔
651
    }
16✔
652

653
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
654
    async deleteStreamConnection(options: FetchOptions<operations["deleteGroupStreamConnection"]>) {
3✔
655
        const { error, response } = await this.client.DELETE(
6✔
656
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}",
6✔
657
            options
6✔
658
        );
6✔
659
        if (error) {
6!
660
            throw ApiClientError.fromError(response, error);
×
661
        }
×
662
    }
6✔
663

664
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
665
    async getStreamConnection(options: FetchOptions<operations["getGroupStreamConnection"]>) {
3✔
666
        const { data, error, response } = await this.client.GET(
4✔
667
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}",
4✔
668
            options
4✔
669
        );
4✔
670
        if (error) {
4✔
671
            throw ApiClientError.fromError(response, error);
1✔
672
        }
1✔
673
        return data;
3✔
674
    }
4✔
675

676
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
677
    async updateStreamConnection(options: FetchOptions<operations["updateGroupStreamConnection"]>) {
3✔
678
        const { data, error, response } = await this.client.PATCH(
1✔
679
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}",
1✔
680
            options
1✔
681
        );
1✔
682
        if (error) {
1!
683
            throw ApiClientError.fromError(response, error);
×
684
        }
×
685
        return data;
1✔
686
    }
1✔
687

688
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
689
    async createStreamProcessor(options: FetchOptions<operations["createGroupStreamProcessor"]>) {
3✔
690
        const { data, error, response } = await this.client.POST(
2✔
691
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor",
2✔
692
            options
2✔
693
        );
2✔
694
        if (error) {
2!
695
            throw ApiClientError.fromError(response, error);
×
696
        }
×
697
        return data;
2✔
698
    }
2✔
699

700
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
701
    async deleteStreamProcessor(options: FetchOptions<operations["deleteGroupStreamProcessor"]>) {
3✔
702
        const { error, response } = await this.client.DELETE(
1✔
703
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}",
1✔
704
            options
1✔
705
        );
1✔
706
        if (error) {
1!
707
            throw ApiClientError.fromError(response, error);
×
708
        }
×
709
    }
1✔
710

711
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
712
    async getStreamProcessor(options: FetchOptions<operations["getGroupStreamProcessor"]>) {
3✔
713
        const { data, error, response } = await this.client.GET(
11✔
714
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}",
11✔
715
            options
11✔
716
        );
11✔
717
        if (error) {
11!
718
            throw ApiClientError.fromError(response, error);
×
719
        }
×
720
        return data;
11✔
721
    }
11✔
722

723
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
724
    async updateStreamProcessor(options: FetchOptions<operations["updateGroupStreamProcessor"]>) {
3✔
725
        const { data, error, response } = await this.client.PATCH(
2✔
726
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}",
2✔
727
            options
2✔
728
        );
2✔
729
        if (error) {
2!
730
            throw ApiClientError.fromError(response, error);
×
731
        }
×
732
        return data;
2✔
733
    }
2✔
734

735
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
736
    async startStreamProcessor(options: FetchOptions<operations["startGroupStreamProcessor"]>) {
3✔
737
        const { error, response } = await this.client.POST(
2✔
738
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}:start",
2✔
739
            options
2✔
740
        );
2✔
741
        if (error) {
2!
742
            throw ApiClientError.fromError(response, error);
×
743
        }
×
744
    }
2✔
745

746
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
747
    async startStreamProcessorWith(options: FetchOptions<operations["startGroupStreamProcessorWith"]>) {
3✔
748
        const { error, response } = await this.client.POST(
×
749
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}:startWith",
×
750
            options
×
751
        );
×
752
        if (error) {
×
753
            throw ApiClientError.fromError(response, error);
×
754
        }
×
755
    }
×
756

757
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
758
    async stopStreamProcessor(options: FetchOptions<operations["stopGroupStreamProcessor"]>) {
3✔
759
        const { error, response } = await this.client.POST(
2✔
760
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processor/{processorName}:stop",
2✔
761
            options
2✔
762
        );
2✔
763
        if (error) {
2!
764
            throw ApiClientError.fromError(response, error);
×
765
        }
×
766
    }
2✔
767

768
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
769
    async getStreamProcessors(options: FetchOptions<operations["getGroupStreamProcessors"]>) {
3✔
770
        const { data, error, response } = await this.client.GET(
4✔
771
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/processors",
4✔
772
            options
4✔
773
        );
4✔
774
        if (error) {
4!
775
            throw ApiClientError.fromError(response, error);
×
776
        }
×
777
        return data;
4✔
778
    }
4✔
779

780
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
781
    async downloadOperationalLogs(options: FetchOptions<operations["downloadGroupStreamOperationalLogs"]>) {
3✔
UNCOV
782
        const { data, error, response } = await this.client.GET(
×
UNCOV
783
            "/api/atlas/v2/groups/{groupId}/streams/{tenantName}:downloadOperationalLogs",
×
UNCOV
784
            { ...options, headers: { Accept: "application/vnd.atlas.2025-03-12+gzip", ...options?.headers } }
×
UNCOV
785
        );
×
UNCOV
786
        if (error) {
×
787
            throw ApiClientError.fromError(response, error);
×
788
        }
×
UNCOV
789
        return data;
×
UNCOV
790
    }
×
791

792
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
793
    async withStreamSampleConnections(options: FetchOptions<operations["withGroupStreamSampleConnections"]>) {
3✔
794
        const { data, error, response } = await this.client.POST(
×
795
            "/api/atlas/v2/groups/{groupId}/streams:withSampleConnections",
×
796
            options
×
797
        );
×
798
        if (error) {
×
799
            throw ApiClientError.fromError(response, error);
×
800
        }
×
801
        return data;
×
802
    }
×
803

804
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
805
    async listOrgs(options?: FetchOptions<operations["listOrgs"]>) {
3✔
806
        const { data, error, response } = await this.client.GET("/api/atlas/v2/orgs", options);
17!
807
        if (error) {
15!
808
            throw ApiClientError.fromError(response, error);
×
809
        }
×
810
        return data;
15✔
811
    }
17✔
812

813
    // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
814
    async getOrgGroups(options: FetchOptions<operations["getOrgGroups"]>) {
3✔
815
        const { data, error, response } = await this.client.GET("/api/atlas/v2/orgs/{orgId}/groups", options);
1✔
816
        if (error) {
1!
817
            throw ApiClientError.fromError(response, error);
×
818
        }
×
819
        return data;
1✔
820
    }
1✔
821
    /* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-return */
822
    // DO NOT EDIT. This is auto-generated code.
823
}
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc