@scaleway/sdk-cockpit 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,692 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const sdkClient = require("@scaleway/sdk-client");
4
+ const marshalling_gen = require("./marshalling.gen.cjs");
5
+ const jsonContentHeaders = {
6
+ "Content-Type": "application/json; charset=utf-8"
7
+ };
8
+ class GlobalAPI extends sdkClient.API {
9
+ /**
10
+ * Get your Cockpit's Grafana. Retrieve information on your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to.
11
+ The output returned displays the URL to access your Cockpit's Grafana.
12
+ *
13
+ * @param request - The request {@link GlobalApiGetGrafanaRequest}
14
+ * @returns A Promise of Grafana
15
+ */
16
+ getGrafana = (request = {}) => this.client.fetch(
17
+ {
18
+ method: "GET",
19
+ path: `/cockpit/v1/grafana`,
20
+ urlParams: sdkClient.urlParams([
21
+ "project_id",
22
+ request.projectId ?? this.client.settings.defaultProjectId
23
+ ])
24
+ },
25
+ marshalling_gen.unmarshalGrafana
26
+ );
27
+ /**
28
+ * Synchronize Grafana data sources. Trigger the synchronization of all your data sources and the alert manager in the relevant regions. The alert manager will only be synchronized if you have enabled it.
29
+ *
30
+ * @param request - The request {@link GlobalApiSyncGrafanaDataSourcesRequest}
31
+ */
32
+ syncGrafanaDataSources = (request = {}) => this.client.fetch({
33
+ body: JSON.stringify(
34
+ marshalling_gen.marshalGlobalApiSyncGrafanaDataSourcesRequest(
35
+ request,
36
+ this.client.settings
37
+ )
38
+ ),
39
+ headers: jsonContentHeaders,
40
+ method: "POST",
41
+ path: `/cockpit/v1/grafana/sync-data-sources`
42
+ });
43
+ /**
44
+ * Create a Grafana user. Create a Grafana user to connect to your Cockpit's Grafana. Upon creation, your user password displays only once, so make sure that you save it.
45
+ Each Grafana user is associated with a role: viewer or editor. A viewer can only view dashboards, whereas an editor can create and edit dashboards. Note that the `admin` username is not available for creation.
46
+ *
47
+ * @param request - The request {@link GlobalApiCreateGrafanaUserRequest}
48
+ * @returns A Promise of GrafanaUser
49
+ */
50
+ createGrafanaUser = (request) => this.client.fetch(
51
+ {
52
+ body: JSON.stringify(
53
+ marshalling_gen.marshalGlobalApiCreateGrafanaUserRequest(
54
+ request,
55
+ this.client.settings
56
+ )
57
+ ),
58
+ headers: jsonContentHeaders,
59
+ method: "POST",
60
+ path: `/cockpit/v1/grafana/users`
61
+ },
62
+ marshalling_gen.unmarshalGrafanaUser
63
+ );
64
+ pageOfListGrafanaUsers = (request = {}) => this.client.fetch(
65
+ {
66
+ method: "GET",
67
+ path: `/cockpit/v1/grafana/users`,
68
+ urlParams: sdkClient.urlParams(
69
+ ["order_by", request.orderBy],
70
+ ["page", request.page],
71
+ [
72
+ "page_size",
73
+ request.pageSize ?? this.client.settings.defaultPageSize
74
+ ],
75
+ [
76
+ "project_id",
77
+ request.projectId ?? this.client.settings.defaultProjectId
78
+ ]
79
+ )
80
+ },
81
+ marshalling_gen.unmarshalListGrafanaUsersResponse
82
+ );
83
+ /**
84
+ * List Grafana users. List all Grafana users created in your Cockpit's Grafana. By default, the Grafana users returned in the list are ordered in ascending order.
85
+ *
86
+ * @param request - The request {@link GlobalApiListGrafanaUsersRequest}
87
+ * @returns A Promise of ListGrafanaUsersResponse
88
+ */
89
+ listGrafanaUsers = (request = {}) => sdkClient.enrichForPagination("grafanaUsers", this.pageOfListGrafanaUsers, request);
90
+ /**
91
+ * Delete a Grafana user. Delete a Grafana user from your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user.
92
+ *
93
+ * @param request - The request {@link GlobalApiDeleteGrafanaUserRequest}
94
+ */
95
+ deleteGrafanaUser = (request) => this.client.fetch({
96
+ method: "DELETE",
97
+ path: `/cockpit/v1/grafana/users/${sdkClient.validatePathParam("grafanaUserId", request.grafanaUserId)}`,
98
+ urlParams: sdkClient.urlParams([
99
+ "project_id",
100
+ request.projectId ?? this.client.settings.defaultProjectId
101
+ ])
102
+ });
103
+ /**
104
+ * Reset a Grafana user password. Reset the password of a Grafana user, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user.
105
+ A new password regenerates and only displays once. Make sure that you save it.
106
+ *
107
+ * @param request - The request {@link GlobalApiResetGrafanaUserPasswordRequest}
108
+ * @returns A Promise of GrafanaUser
109
+ */
110
+ resetGrafanaUserPassword = (request) => this.client.fetch(
111
+ {
112
+ body: JSON.stringify(
113
+ marshalling_gen.marshalGlobalApiResetGrafanaUserPasswordRequest(
114
+ request,
115
+ this.client.settings
116
+ )
117
+ ),
118
+ headers: jsonContentHeaders,
119
+ method: "POST",
120
+ path: `/cockpit/v1/grafana/users/${sdkClient.validatePathParam("grafanaUserId", request.grafanaUserId)}/reset-password`
121
+ },
122
+ marshalling_gen.unmarshalGrafanaUser
123
+ );
124
+ pageOfListGrafanaProductDashboards = (request = {}) => this.client.fetch(
125
+ {
126
+ method: "GET",
127
+ path: `/cockpit/v1/grafana/product-dashboards`,
128
+ urlParams: sdkClient.urlParams(
129
+ ["page", request.page],
130
+ [
131
+ "page_size",
132
+ request.pageSize ?? this.client.settings.defaultPageSize
133
+ ],
134
+ [
135
+ "project_id",
136
+ request.projectId ?? this.client.settings.defaultProjectId
137
+ ],
138
+ ["tags", request.tags]
139
+ )
140
+ },
141
+ marshalling_gen.unmarshalListGrafanaProductDashboardsResponse
142
+ );
143
+ /**
144
+ * List Scaleway resources dashboards. Retrieve a list of available dashboards in Grafana, for all Scaleway resources which are integrated with Cockpit.
145
+ *
146
+ * @param request - The request {@link GlobalApiListGrafanaProductDashboardsRequest}
147
+ * @returns A Promise of ListGrafanaProductDashboardsResponse
148
+ */
149
+ listGrafanaProductDashboards = (request = {}) => sdkClient.enrichForPagination(
150
+ "dashboards",
151
+ this.pageOfListGrafanaProductDashboards,
152
+ request
153
+ );
154
+ /**
155
+ * Get Scaleway resource dashboard. Retrieve information about the dashboard of a Scaleway resource in Grafana, specified by the ID of the Project the Cockpit belongs to, and the name of the dashboard.
156
+ *
157
+ * @param request - The request {@link GlobalApiGetGrafanaProductDashboardRequest}
158
+ * @returns A Promise of GrafanaProductDashboard
159
+ */
160
+ getGrafanaProductDashboard = (request) => this.client.fetch(
161
+ {
162
+ method: "GET",
163
+ path: `/cockpit/v1/grafana/product-dashboards/${sdkClient.validatePathParam("dashboardName", request.dashboardName)}`,
164
+ urlParams: sdkClient.urlParams([
165
+ "project_id",
166
+ request.projectId ?? this.client.settings.defaultProjectId
167
+ ])
168
+ },
169
+ marshalling_gen.unmarshalGrafanaProductDashboard
170
+ );
171
+ pageOfListPlans = (request = {}) => this.client.fetch(
172
+ {
173
+ method: "GET",
174
+ path: `/cockpit/v1/plans`,
175
+ urlParams: sdkClient.urlParams(
176
+ ["order_by", request.orderBy],
177
+ ["page", request.page],
178
+ [
179
+ "page_size",
180
+ request.pageSize ?? this.client.settings.defaultPageSize
181
+ ]
182
+ )
183
+ },
184
+ marshalling_gen.unmarshalListPlansResponse
185
+ );
186
+ /**
187
+ * List plan types. Retrieve a list of available pricing plan types.
188
+ Deprecated: retention is now managed at the data source level.
189
+ *
190
+ * @deprecated
191
+ * @param request - The request {@link GlobalApiListPlansRequest}
192
+ * @returns A Promise of ListPlansResponse
193
+ */
194
+ listPlans = (request = {}) => sdkClient.enrichForPagination("plans", this.pageOfListPlans, request);
195
+ /**
196
+ * Apply a pricing plan. Apply a pricing plan on a given Project. You must specify the ID of the pricing plan type. Note that you will be billed for the plan you apply.
197
+ Deprecated: retention is now managed at the data source level.
198
+ *
199
+ * @deprecated
200
+ * @param request - The request {@link GlobalApiSelectPlanRequest}
201
+ * @returns A Promise of Plan
202
+ */
203
+ selectPlan = (request = {}) => this.client.fetch(
204
+ {
205
+ body: JSON.stringify(
206
+ marshalling_gen.marshalGlobalApiSelectPlanRequest(request, this.client.settings)
207
+ ),
208
+ headers: jsonContentHeaders,
209
+ method: "PATCH",
210
+ path: `/cockpit/v1/plans`
211
+ },
212
+ marshalling_gen.unmarshalPlan
213
+ );
214
+ /**
215
+ * Get current plan. Retrieve a pricing plan for the given Project, specified by the ID of the Project.
216
+ Deprecated: retention is now managed at the data source level.
217
+ *
218
+ * @deprecated
219
+ * @param request - The request {@link GlobalApiGetCurrentPlanRequest}
220
+ * @returns A Promise of Plan
221
+ */
222
+ getCurrentPlan = (request = {}) => this.client.fetch(
223
+ {
224
+ method: "GET",
225
+ path: `/cockpit/v1/current-plan`,
226
+ urlParams: sdkClient.urlParams([
227
+ "project_id",
228
+ request.projectId ?? this.client.settings.defaultProjectId
229
+ ])
230
+ },
231
+ marshalling_gen.unmarshalPlan
232
+ );
233
+ }
234
+ class RegionalAPI extends sdkClient.API {
235
+ /** Lists the available regions of the API. */
236
+ static LOCALITIES = [
237
+ "fr-par",
238
+ "nl-ams",
239
+ "pl-waw"
240
+ ];
241
+ /**
242
+ * Get the Cockpit configuration.
243
+ *
244
+ * @param request - The request {@link RegionalApiGetConfigRequest}
245
+ * @returns A Promise of GetConfigResponse
246
+ */
247
+ getConfig = (request = {}) => this.client.fetch(
248
+ {
249
+ method: "GET",
250
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/config`
251
+ },
252
+ marshalling_gen.unmarshalGetConfigResponse
253
+ );
254
+ /**
255
+ * Create a data source. You must specify the data source type upon creation. Available data source types include:
256
+ - metrics
257
+ - logs
258
+ - traces
259
+ The name of the data source will then be used as reference to name the associated Grafana data source.
260
+ *
261
+ * @param request - The request {@link RegionalApiCreateDataSourceRequest}
262
+ * @returns A Promise of DataSource
263
+ */
264
+ createDataSource = (request) => this.client.fetch(
265
+ {
266
+ body: JSON.stringify(
267
+ marshalling_gen.marshalRegionalApiCreateDataSourceRequest(
268
+ request,
269
+ this.client.settings
270
+ )
271
+ ),
272
+ headers: jsonContentHeaders,
273
+ method: "POST",
274
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources`
275
+ },
276
+ marshalling_gen.unmarshalDataSource
277
+ );
278
+ /**
279
+ * Get a data source. Retrieve information about a given data source, specified by the data source ID. The data source's information such as its name, type, URL, origin, and retention period, is returned.
280
+ *
281
+ * @param request - The request {@link RegionalApiGetDataSourceRequest}
282
+ * @returns A Promise of DataSource
283
+ */
284
+ getDataSource = (request) => this.client.fetch(
285
+ {
286
+ method: "GET",
287
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources/${sdkClient.validatePathParam("dataSourceId", request.dataSourceId)}`
288
+ },
289
+ marshalling_gen.unmarshalDataSource
290
+ );
291
+ /**
292
+ * Delete a data source. Delete a given data source, specified by the data source ID. Note that deleting a data source is irreversible, and cannot be undone.
293
+ *
294
+ * @param request - The request {@link RegionalApiDeleteDataSourceRequest}
295
+ */
296
+ deleteDataSource = (request) => this.client.fetch({
297
+ method: "DELETE",
298
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources/${sdkClient.validatePathParam("dataSourceId", request.dataSourceId)}`
299
+ });
300
+ pageOfListDataSources = (request = {}) => this.client.fetch(
301
+ {
302
+ method: "GET",
303
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources`,
304
+ urlParams: sdkClient.urlParams(
305
+ ["order_by", request.orderBy],
306
+ ["origin", request.origin],
307
+ ["page", request.page],
308
+ [
309
+ "page_size",
310
+ request.pageSize ?? this.client.settings.defaultPageSize
311
+ ],
312
+ [
313
+ "project_id",
314
+ request.projectId ?? this.client.settings.defaultProjectId
315
+ ],
316
+ ["types", request.types]
317
+ )
318
+ },
319
+ marshalling_gen.unmarshalListDataSourcesResponse
320
+ );
321
+ /**
322
+ * List data sources. Retrieve the list of data sources available in the specified region. By default, the data sources returned in the list are ordered by creation date, in ascending order.
323
+ You can list data sources by Project, type and origin.
324
+ *
325
+ * @param request - The request {@link RegionalApiListDataSourcesRequest}
326
+ * @returns A Promise of ListDataSourcesResponse
327
+ */
328
+ listDataSources = (request = {}) => sdkClient.enrichForPagination("dataSources", this.pageOfListDataSources, request);
329
+ /**
330
+ * Update a data source. Update a given data source name, specified by the data source ID.
331
+ *
332
+ * @param request - The request {@link RegionalApiUpdateDataSourceRequest}
333
+ * @returns A Promise of DataSource
334
+ */
335
+ updateDataSource = (request) => this.client.fetch(
336
+ {
337
+ body: JSON.stringify(
338
+ marshalling_gen.marshalRegionalApiUpdateDataSourceRequest(
339
+ request,
340
+ this.client.settings
341
+ )
342
+ ),
343
+ headers: jsonContentHeaders,
344
+ method: "PATCH",
345
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources/${sdkClient.validatePathParam("dataSourceId", request.dataSourceId)}`
346
+ },
347
+ marshalling_gen.unmarshalDataSource
348
+ );
349
+ /**
350
+ * Get data source usage overview. Retrieve the data source usage overview per type for the specified Project.
351
+ *
352
+ * @param request - The request {@link RegionalApiGetUsageOverviewRequest}
353
+ * @returns A Promise of UsageOverview
354
+ */
355
+ getUsageOverview = (request = {}) => this.client.fetch(
356
+ {
357
+ method: "GET",
358
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/usage-overview`,
359
+ urlParams: sdkClient.urlParams(
360
+ ["interval", request.interval],
361
+ [
362
+ "project_id",
363
+ request.projectId ?? this.client.settings.defaultProjectId
364
+ ]
365
+ )
366
+ },
367
+ marshalling_gen.unmarshalUsageOverview
368
+ );
369
+ /**
370
+ * Create a token. Give your token the relevant scopes to ensure it has the right permissions to interact with your data sources and the Alert manager. Make sure that you create your token in the same regions as the data sources you want to use it for.
371
+ Upon creation, your token's secret key display only once. Make sure that you save it.
372
+ *
373
+ * @param request - The request {@link RegionalApiCreateTokenRequest}
374
+ * @returns A Promise of Token
375
+ */
376
+ createToken = (request) => this.client.fetch(
377
+ {
378
+ body: JSON.stringify(
379
+ marshalling_gen.marshalRegionalApiCreateTokenRequest(request, this.client.settings)
380
+ ),
381
+ headers: jsonContentHeaders,
382
+ method: "POST",
383
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`
384
+ },
385
+ marshalling_gen.unmarshalToken
386
+ );
387
+ pageOfListTokens = (request = {}) => this.client.fetch(
388
+ {
389
+ method: "GET",
390
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`,
391
+ urlParams: sdkClient.urlParams(
392
+ ["order_by", request.orderBy],
393
+ ["page", request.page],
394
+ [
395
+ "page_size",
396
+ request.pageSize ?? this.client.settings.defaultPageSize
397
+ ],
398
+ [
399
+ "project_id",
400
+ request.projectId ?? this.client.settings.defaultProjectId
401
+ ],
402
+ ["token_scopes", request.tokenScopes]
403
+ )
404
+ },
405
+ marshalling_gen.unmarshalListTokensResponse
406
+ );
407
+ /**
408
+ * List tokens. Retrieve a list of all tokens in the specified region. By default, tokens returned in the list are ordered by creation date, in ascending order.
409
+ You can filter tokens by Project ID and token scopes.
410
+ *
411
+ * @param request - The request {@link RegionalApiListTokensRequest}
412
+ * @returns A Promise of ListTokensResponse
413
+ */
414
+ listTokens = (request = {}) => sdkClient.enrichForPagination("tokens", this.pageOfListTokens, request);
415
+ /**
416
+ * Get a token. Retrieve information about a given token, specified by the token ID. The token's information such as its scopes, is returned.
417
+ *
418
+ * @param request - The request {@link RegionalApiGetTokenRequest}
419
+ * @returns A Promise of Token
420
+ */
421
+ getToken = (request) => this.client.fetch(
422
+ {
423
+ method: "GET",
424
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${sdkClient.validatePathParam("tokenId", request.tokenId)}`
425
+ },
426
+ marshalling_gen.unmarshalToken
427
+ );
428
+ /**
429
+ * Delete a token. Delete a given token, specified by the token ID. Deleting a token is irreversible and cannot be undone.
430
+ *
431
+ * @param request - The request {@link RegionalApiDeleteTokenRequest}
432
+ */
433
+ deleteToken = (request) => this.client.fetch({
434
+ method: "DELETE",
435
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${sdkClient.validatePathParam("tokenId", request.tokenId)}`
436
+ });
437
+ /**
438
+ * Get the Alert manager. Retrieve information about the Alert manager which is unique per Project and region. By default the Alert manager is disabled.
439
+ The output returned displays a URL to access the Alert manager, and whether the Alert manager and managed alerts are enabled.
440
+ *
441
+ * @param request - The request {@link RegionalApiGetAlertManagerRequest}
442
+ * @returns A Promise of AlertManager
443
+ */
444
+ getAlertManager = (request = {}) => this.client.fetch(
445
+ {
446
+ method: "GET",
447
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager`,
448
+ urlParams: sdkClient.urlParams([
449
+ "project_id",
450
+ request.projectId ?? this.client.settings.defaultProjectId
451
+ ])
452
+ },
453
+ marshalling_gen.unmarshalAlertManager
454
+ );
455
+ /**
456
+ * Enable the Alert manager. Enabling the Alert manager allows you to enable managed alerts and create contact points in the specified Project and region, to be notified when your Scaleway resources may require your attention.
457
+ *
458
+ * @param request - The request {@link RegionalApiEnableAlertManagerRequest}
459
+ * @returns A Promise of AlertManager
460
+ */
461
+ enableAlertManager = (request = {}) => this.client.fetch(
462
+ {
463
+ body: JSON.stringify(
464
+ marshalling_gen.marshalRegionalApiEnableAlertManagerRequest(
465
+ request,
466
+ this.client.settings
467
+ )
468
+ ),
469
+ headers: jsonContentHeaders,
470
+ method: "POST",
471
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/enable`
472
+ },
473
+ marshalling_gen.unmarshalAlertManager
474
+ );
475
+ /**
476
+ * Disable the Alert manager. Disabling the Alert manager deletes the contact points you have created and disables managed alerts in the specified Project and region.
477
+ *
478
+ * @param request - The request {@link RegionalApiDisableAlertManagerRequest}
479
+ * @returns A Promise of AlertManager
480
+ */
481
+ disableAlertManager = (request = {}) => this.client.fetch(
482
+ {
483
+ body: JSON.stringify(
484
+ marshalling_gen.marshalRegionalApiDisableAlertManagerRequest(
485
+ request,
486
+ this.client.settings
487
+ )
488
+ ),
489
+ headers: jsonContentHeaders,
490
+ method: "POST",
491
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/disable`
492
+ },
493
+ marshalling_gen.unmarshalAlertManager
494
+ );
495
+ /**
496
+ * Create a contact point. Contact points are email addresses associated with the default receiver, that the Alert manager sends alerts to.
497
+ The source of the alerts are data sources within the same Project and region as the Alert manager.
498
+ If you need to receive alerts for other receivers, you can create additional contact points and receivers in Grafana. Make sure that you select the Scaleway Alert manager.
499
+ *
500
+ * @param request - The request {@link RegionalApiCreateContactPointRequest}
501
+ * @returns A Promise of ContactPoint
502
+ */
503
+ createContactPoint = (request = {}) => this.client.fetch(
504
+ {
505
+ body: JSON.stringify(
506
+ marshalling_gen.marshalRegionalApiCreateContactPointRequest(
507
+ request,
508
+ this.client.settings
509
+ )
510
+ ),
511
+ headers: jsonContentHeaders,
512
+ method: "POST",
513
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points`
514
+ },
515
+ marshalling_gen.unmarshalContactPoint
516
+ );
517
+ pageOfListContactPoints = (request = {}) => this.client.fetch(
518
+ {
519
+ method: "GET",
520
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points`,
521
+ urlParams: sdkClient.urlParams(
522
+ ["page", request.page],
523
+ [
524
+ "page_size",
525
+ request.pageSize ?? this.client.settings.defaultPageSize
526
+ ],
527
+ [
528
+ "project_id",
529
+ request.projectId ?? this.client.settings.defaultProjectId
530
+ ]
531
+ )
532
+ },
533
+ marshalling_gen.unmarshalListContactPointsResponse
534
+ );
535
+ /**
536
+ * List contact points. Retrieve a list of contact points for the specified Project. The response lists all contact points and receivers created in Grafana or via the API.
537
+ *
538
+ * @param request - The request {@link RegionalApiListContactPointsRequest}
539
+ * @returns A Promise of ListContactPointsResponse
540
+ */
541
+ listContactPoints = (request = {}) => sdkClient.enrichForPagination("contactPoints", this.pageOfListContactPoints, request);
542
+ updateContactPoint = (request = {}) => this.client.fetch(
543
+ {
544
+ body: JSON.stringify(
545
+ marshalling_gen.marshalRegionalApiUpdateContactPointRequest(
546
+ request,
547
+ this.client.settings
548
+ )
549
+ ),
550
+ headers: jsonContentHeaders,
551
+ method: "PATCH",
552
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points`
553
+ },
554
+ marshalling_gen.unmarshalContactPoint
555
+ );
556
+ /**
557
+ * Delete a contact point. Delete a contact point associated with the default receiver.
558
+ *
559
+ * @param request - The request {@link RegionalApiDeleteContactPointRequest}
560
+ */
561
+ deleteContactPoint = (request = {}) => this.client.fetch({
562
+ body: JSON.stringify(
563
+ marshalling_gen.marshalRegionalApiDeleteContactPointRequest(
564
+ request,
565
+ this.client.settings
566
+ )
567
+ ),
568
+ headers: jsonContentHeaders,
569
+ method: "POST",
570
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points/delete`
571
+ });
572
+ /**
573
+ * List alerts. List preconfigured and/or custom alerts for the specified Project.
574
+ *
575
+ * @param request - The request {@link RegionalApiListAlertsRequest}
576
+ * @returns A Promise of ListAlertsResponse
577
+ */
578
+ listAlerts = (request = {}) => this.client.fetch(
579
+ {
580
+ method: "GET",
581
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alerts`,
582
+ urlParams: sdkClient.urlParams(
583
+ ["is_enabled", request.isEnabled],
584
+ ["is_preconfigured", request.isPreconfigured],
585
+ [
586
+ "project_id",
587
+ request.projectId ?? this.client.settings.defaultProjectId
588
+ ],
589
+ ["state", request.state]
590
+ )
591
+ },
592
+ marshalling_gen.unmarshalListAlertsResponse
593
+ );
594
+ /**
595
+ * Enable managed alerts. Enable the sending of managed alerts for the specified Project. Managed alerts are predefined alerts that apply to Scaleway recources integrated with Cockpit by default.
596
+ *
597
+ * @param request - The request {@link RegionalApiEnableManagedAlertsRequest}
598
+ * @returns A Promise of AlertManager
599
+ */
600
+ enableManagedAlerts = (request = {}) => this.client.fetch(
601
+ {
602
+ body: JSON.stringify(
603
+ marshalling_gen.marshalRegionalApiEnableManagedAlertsRequest(
604
+ request,
605
+ this.client.settings
606
+ )
607
+ ),
608
+ headers: jsonContentHeaders,
609
+ method: "POST",
610
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/managed-alerts/enable`
611
+ },
612
+ marshalling_gen.unmarshalAlertManager
613
+ );
614
+ /**
615
+ * Disable managed alerts. Disable the sending of managed alerts for the specified Project.
616
+ *
617
+ * @param request - The request {@link RegionalApiDisableManagedAlertsRequest}
618
+ * @returns A Promise of AlertManager
619
+ */
620
+ disableManagedAlerts = (request = {}) => this.client.fetch(
621
+ {
622
+ body: JSON.stringify(
623
+ marshalling_gen.marshalRegionalApiDisableManagedAlertsRequest(
624
+ request,
625
+ this.client.settings
626
+ )
627
+ ),
628
+ headers: jsonContentHeaders,
629
+ method: "POST",
630
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/managed-alerts/disable`
631
+ },
632
+ marshalling_gen.unmarshalAlertManager
633
+ );
634
+ /**
635
+ * Enable preconfigured alert rules. Enable alert rules from the list of available preconfigured rules.
636
+ *
637
+ * @param request - The request {@link RegionalApiEnableAlertRulesRequest}
638
+ * @returns A Promise of EnableAlertRulesResponse
639
+ */
640
+ enableAlertRules = (request = {}) => this.client.fetch(
641
+ {
642
+ body: JSON.stringify(
643
+ marshalling_gen.marshalRegionalApiEnableAlertRulesRequest(
644
+ request,
645
+ this.client.settings
646
+ )
647
+ ),
648
+ headers: jsonContentHeaders,
649
+ method: "POST",
650
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/enable-alert-rules`
651
+ },
652
+ marshalling_gen.unmarshalEnableAlertRulesResponse
653
+ );
654
+ /**
655
+ * Disable preconfigured alert rules. Disable alert rules from the list of available preconfigured rules.
656
+ *
657
+ * @param request - The request {@link RegionalApiDisableAlertRulesRequest}
658
+ * @returns A Promise of DisableAlertRulesResponse
659
+ */
660
+ disableAlertRules = (request = {}) => this.client.fetch(
661
+ {
662
+ body: JSON.stringify(
663
+ marshalling_gen.marshalRegionalApiDisableAlertRulesRequest(
664
+ request,
665
+ this.client.settings
666
+ )
667
+ ),
668
+ headers: jsonContentHeaders,
669
+ method: "POST",
670
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/disable-alert-rules`
671
+ },
672
+ marshalling_gen.unmarshalDisableAlertRulesResponse
673
+ );
674
+ /**
675
+ * Trigger a test alert. Send a test alert to the Alert manager to make sure your contact points get notified.
676
+ *
677
+ * @param request - The request {@link RegionalApiTriggerTestAlertRequest}
678
+ */
679
+ triggerTestAlert = (request = {}) => this.client.fetch({
680
+ body: JSON.stringify(
681
+ marshalling_gen.marshalRegionalApiTriggerTestAlertRequest(
682
+ request,
683
+ this.client.settings
684
+ )
685
+ ),
686
+ headers: jsonContentHeaders,
687
+ method: "POST",
688
+ path: `/cockpit/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/trigger-test-alert`
689
+ });
690
+ }
691
+ exports.GlobalAPI = GlobalAPI;
692
+ exports.RegionalAPI = RegionalAPI;