@@ -12,6 +12,7 @@ import { COCKPIT_TRANSIENT_STATUSES } from './content.gen'
12
12
import {
13
13
marshalActivateCockpitRequest ,
14
14
marshalCreateContactPointRequest ,
15
+ marshalCreateDatasourceRequest ,
15
16
marshalCreateGrafanaUserRequest ,
16
17
marshalCreateTokenRequest ,
17
18
marshalDeactivateCockpitRequest ,
@@ -26,6 +27,7 @@ import {
26
27
unmarshalCockpit ,
27
28
unmarshalCockpitMetrics ,
28
29
unmarshalContactPoint ,
30
+ unmarshalDatasource ,
29
31
unmarshalGrafanaUser ,
30
32
unmarshalListContactPointsResponse ,
31
33
unmarshalListGrafanaUsersResponse ,
@@ -40,8 +42,10 @@ import type {
40
42
CockpitMetrics ,
41
43
ContactPoint ,
42
44
CreateContactPointRequest ,
45
+ CreateDatasourceRequest ,
43
46
CreateGrafanaUserRequest ,
44
47
CreateTokenRequest ,
48
+ Datasource ,
45
49
DeactivateCockpitRequest ,
46
50
DeleteContactPointRequest ,
47
51
DeleteGrafanaUserRequest ,
@@ -75,13 +79,13 @@ const jsonContentHeaders = {
75
79
/**
76
80
* Cockpit API.
77
81
*
78
- * Cockpit API. Cockpit 's API allows you to activate your Cockpit on your
79
- * Projects. Scaleway's Cockpit stores metrics and logs and provides a dedicated
80
- * Grafana for dashboarding to visualize them.
82
+ * Cockpit's API allows you to activate your Cockpit on your Projects.
83
+ * Scaleway's Cockpit stores metrics and logs and provides a dedicated Grafana
84
+ * for dashboarding to visualize them. Cockpit API .
81
85
*/
82
86
export class API extends ParentAPI {
83
87
/**
84
- * Activate a Cockpit. Activate the Cockpit of the specified Project ID.
88
+ * Activate the Cockpit of the specified Project ID.
85
89
*
86
90
* @param request - The request {@link ActivateCockpitRequest}
87
91
* @returns A Promise of Cockpit
@@ -100,7 +104,7 @@ export class API extends ParentAPI {
100
104
)
101
105
102
106
/**
103
- * Get a Cockpit. Retrieve the Cockpit of the specified Project ID.
107
+ * Retrieve the Cockpit of the specified Project ID.
104
108
*
105
109
* @param request - The request {@link GetCockpitRequest}
106
110
* @returns A Promise of Cockpit
@@ -139,8 +143,7 @@ export class API extends ParentAPI {
139
143
)
140
144
141
145
/**
142
- * Get Cockpit metrics. Get metrics from your Cockpit with the specified
143
- * Project ID.
146
+ * Get metrics from your Cockpit with the specified Project ID.
144
147
*
145
148
* @param request - The request {@link GetCockpitMetricsRequest}
146
149
* @returns A Promise of CockpitMetrics
@@ -164,7 +167,7 @@ export class API extends ParentAPI {
164
167
)
165
168
166
169
/**
167
- * Deactivate a Cockpit. Deactivate the Cockpit of the specified Project ID.
170
+ * Deactivate the Cockpit of the specified Project ID.
168
171
*
169
172
* @param request - The request {@link DeactivateCockpitRequest}
170
173
* @returns A Promise of Cockpit
@@ -183,8 +186,7 @@ export class API extends ParentAPI {
183
186
)
184
187
185
188
/**
186
- * Reset a Grafana. Reset your Cockpit's Grafana associated with the specified
187
- * Project ID.
189
+ * Reset your Cockpit's Grafana associated with the specified Project ID.
188
190
*
189
191
* @param request - The request {@link ResetCockpitGrafanaRequest}
190
192
* @returns A Promise of Cockpit
@@ -203,7 +205,26 @@ export class API extends ParentAPI {
203
205
)
204
206
205
207
/**
206
- * Create a token. Create a token associated with the specified Project ID.
208
+ * Create a datasource for the specified Project ID and the given type.
209
+ *
210
+ * @param request - The request {@link CreateDatasourceRequest}
211
+ * @returns A Promise of Datasource
212
+ */
213
+ createDatasource = ( request : Readonly < CreateDatasourceRequest > ) =>
214
+ this . client . fetch < Datasource > (
215
+ {
216
+ body : JSON . stringify (
217
+ marshalCreateDatasourceRequest ( request , this . client . settings ) ,
218
+ ) ,
219
+ headers : jsonContentHeaders ,
220
+ method : 'POST' ,
221
+ path : `/cockpit/v1beta1/datasources` ,
222
+ } ,
223
+ unmarshalDatasource ,
224
+ )
225
+
226
+ /**
227
+ * Create a token associated with the specified Project ID.
207
228
*
208
229
* @param request - The request {@link CreateTokenRequest}
209
230
* @returns A Promise of Token
@@ -243,7 +264,7 @@ export class API extends ParentAPI {
243
264
)
244
265
245
266
/**
246
- * List tokens. Get a list of tokens associated with the specified Project ID.
267
+ * Get a list of tokens associated with the specified Project ID.
247
268
*
248
269
* @param request - The request {@link ListTokensRequest}
249
270
* @returns A Promise of ListTokensResponse
@@ -252,7 +273,7 @@ export class API extends ParentAPI {
252
273
enrichForPagination ( 'tokens' , this . pageOfListTokens , request )
253
274
254
275
/**
255
- * Get a token. Retrieve the token associated with the specified token ID.
276
+ * Retrieve the token associated with the specified token ID.
256
277
*
257
278
* @param request - The request {@link GetTokenRequest}
258
279
* @returns A Promise of Token
@@ -270,7 +291,7 @@ export class API extends ParentAPI {
270
291
)
271
292
272
293
/**
273
- * Delete a token. Delete the token associated with the specified token ID.
294
+ * Delete the token associated with the specified token ID.
274
295
*
275
296
* @param request - The request {@link DeleteTokenRequest}
276
297
*/
@@ -284,8 +305,7 @@ export class API extends ParentAPI {
284
305
} )
285
306
286
307
/**
287
- * Create a contact point. Create a contact point to receive alerts for the
288
- * default receiver.
308
+ * Create a contact point to receive alerts for the default receiver.
289
309
*
290
310
* @param request - The request {@link CreateContactPointRequest}
291
311
* @returns A Promise of ContactPoint
@@ -326,8 +346,8 @@ export class API extends ParentAPI {
326
346
)
327
347
328
348
/**
329
- * List contact points. Get a list of contact points for the Cockpit
330
- * associated with the specified Project ID.
349
+ * Get a list of contact points for the Cockpit associated with the specified
350
+ * Project ID.
331
351
*
332
352
* @param request - The request {@link ListContactPointsRequest}
333
353
* @returns A Promise of ListContactPointsResponse
@@ -336,8 +356,7 @@ export class API extends ParentAPI {
336
356
enrichForPagination ( 'contactPoints' , this . pageOfListContactPoints , request )
337
357
338
358
/**
339
- * Delete an alert contact point. Delete a contact point for the default
340
- * receiver.
359
+ * Delete a contact point for the default receiver.
341
360
*
342
361
* @param request - The request {@link DeleteContactPointRequest}
343
362
*/
@@ -352,8 +371,7 @@ export class API extends ParentAPI {
352
371
} )
353
372
354
373
/**
355
- * Enable managed alerts. Enable the sending of managed alerts for the
356
- * specified Project's Cockpit.
374
+ * Enable the sending of managed alerts for the specified Project's Cockpit.
357
375
*
358
376
* @param request - The request {@link EnableManagedAlertsRequest}
359
377
*/
@@ -368,8 +386,7 @@ export class API extends ParentAPI {
368
386
} )
369
387
370
388
/**
371
- * Disable managed alerts. Disable the sending of managed alerts for the
372
- * specified Project's Cockpit.
389
+ * Disable the sending of managed alerts for the specified Project's Cockpit.
373
390
*
374
391
* @param request - The request {@link DisableManagedAlertsRequest}
375
392
*/
@@ -386,8 +403,7 @@ export class API extends ParentAPI {
386
403
} )
387
404
388
405
/**
389
- * Trigger a test alert. Trigger a test alert to all of the Cockpit's
390
- * receivers.
406
+ * Trigger a test alert to all of the Cockpit's receivers.
391
407
*
392
408
* @param request - The request {@link TriggerTestAlertRequest}
393
409
*/
@@ -402,9 +418,8 @@ export class API extends ParentAPI {
402
418
} )
403
419
404
420
/**
405
- * Create a Grafana user. Create a Grafana user for your Cockpit's Grafana
406
- * instance. Make sure you save the automatically-generated password and the
407
- * Grafana user ID.
421
+ * Create a Grafana user for your Cockpit's Grafana instance. Make sure you
422
+ * save the automatically-generated password and the Grafana user ID.
408
423
*
409
424
* @param request - The request {@link CreateGrafanaUserRequest}
410
425
* @returns A Promise of GrafanaUser
@@ -446,8 +461,8 @@ export class API extends ParentAPI {
446
461
)
447
462
448
463
/**
449
- * List Grafana users. Get a list of Grafana users who are able to connect to
450
- * the Cockpit's Grafana instance.
464
+ * Get a list of Grafana users who are able to connect to the Cockpit's
465
+ * Grafana instance.
451
466
*
452
467
* @param request - The request {@link ListGrafanaUsersRequest}
453
468
* @returns A Promise of ListGrafanaUsersResponse
@@ -456,8 +471,8 @@ export class API extends ParentAPI {
456
471
enrichForPagination ( 'grafanaUsers' , this . pageOfListGrafanaUsers , request )
457
472
458
473
/**
459
- * Delete a Grafana user. Delete a Grafana user from a Grafana instance,
460
- * specified by the Cockpit's Project ID and the Grafana user ID.
474
+ * Delete a Grafana user from a Grafana instance, specified by the Cockpit's
475
+ * Project ID and the Grafana user ID.
461
476
*
462
477
* @param request - The request {@link DeleteGrafanaUserRequest}
463
478
*/
@@ -475,8 +490,8 @@ export class API extends ParentAPI {
475
490
} )
476
491
477
492
/**
478
- * Reset a Grafana user's password. Reset a Grafana user 's password specified
479
- * by the Cockpit's Project ID and the Grafana user ID.
493
+ * Reset a Grafana user's password specified by the Cockpit 's Project ID and
494
+ * the Grafana user ID.
480
495
*
481
496
* @param request - The request {@link ResetGrafanaUserPasswordRequest}
482
497
* @returns A Promise of GrafanaUser
@@ -517,7 +532,7 @@ export class API extends ParentAPI {
517
532
)
518
533
519
534
/**
520
- * List pricing plans. Get a list of all pricing plans available.
535
+ * Get a list of all pricing plans available.
521
536
*
522
537
* @param request - The request {@link ListPlansRequest}
523
538
* @returns A Promise of ListPlansResponse
@@ -526,9 +541,8 @@ export class API extends ParentAPI {
526
541
enrichForPagination ( 'plans' , this . pageOfListPlans , request )
527
542
528
543
/**
529
- * Select pricing plan. Select your chosen pricing plan for your Cockpit,
530
- * specifying the Cockpit's Project ID and the pricing plan's ID in the
531
- * request.
544
+ * Select your chosen pricing plan for your Cockpit, specifying the Cockpit's
545
+ * Project ID and the pricing plan's ID in the request.
532
546
*
533
547
* @param request - The request {@link SelectPlanRequest}
534
548
* @returns A Promise of SelectPlanResponse
0 commit comments