@@ -12,6 +12,7 @@ import { COCKPIT_TRANSIENT_STATUSES } from './content.gen'
1212import {
1313 marshalActivateCockpitRequest ,
1414 marshalCreateContactPointRequest ,
15+ marshalCreateDatasourceRequest ,
1516 marshalCreateGrafanaUserRequest ,
1617 marshalCreateTokenRequest ,
1718 marshalDeactivateCockpitRequest ,
@@ -26,6 +27,7 @@ import {
2627 unmarshalCockpit ,
2728 unmarshalCockpitMetrics ,
2829 unmarshalContactPoint ,
30+ unmarshalDatasource ,
2931 unmarshalGrafanaUser ,
3032 unmarshalListContactPointsResponse ,
3133 unmarshalListGrafanaUsersResponse ,
@@ -40,8 +42,10 @@ import type {
4042 CockpitMetrics ,
4143 ContactPoint ,
4244 CreateContactPointRequest ,
45+ CreateDatasourceRequest ,
4346 CreateGrafanaUserRequest ,
4447 CreateTokenRequest ,
48+ Datasource ,
4549 DeactivateCockpitRequest ,
4650 DeleteContactPointRequest ,
4751 DeleteGrafanaUserRequest ,
@@ -75,13 +79,13 @@ const jsonContentHeaders = {
7579/**
7680 * Cockpit API.
7781 *
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 .
8185 */
8286export class API extends ParentAPI {
8387 /**
84- * Activate a Cockpit. Activate the Cockpit of the specified Project ID.
88+ * Activate the Cockpit of the specified Project ID.
8589 *
8690 * @param request - The request {@link ActivateCockpitRequest}
8791 * @returns A Promise of Cockpit
@@ -100,7 +104,7 @@ export class API extends ParentAPI {
100104 )
101105
102106 /**
103- * Get a Cockpit. Retrieve the Cockpit of the specified Project ID.
107+ * Retrieve the Cockpit of the specified Project ID.
104108 *
105109 * @param request - The request {@link GetCockpitRequest}
106110 * @returns A Promise of Cockpit
@@ -139,8 +143,7 @@ export class API extends ParentAPI {
139143 )
140144
141145 /**
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.
144147 *
145148 * @param request - The request {@link GetCockpitMetricsRequest}
146149 * @returns A Promise of CockpitMetrics
@@ -164,7 +167,7 @@ export class API extends ParentAPI {
164167 )
165168
166169 /**
167- * Deactivate a Cockpit. Deactivate the Cockpit of the specified Project ID.
170+ * Deactivate the Cockpit of the specified Project ID.
168171 *
169172 * @param request - The request {@link DeactivateCockpitRequest}
170173 * @returns A Promise of Cockpit
@@ -183,8 +186,7 @@ export class API extends ParentAPI {
183186 )
184187
185188 /**
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.
188190 *
189191 * @param request - The request {@link ResetCockpitGrafanaRequest}
190192 * @returns A Promise of Cockpit
@@ -203,7 +205,26 @@ export class API extends ParentAPI {
203205 )
204206
205207 /**
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.
207228 *
208229 * @param request - The request {@link CreateTokenRequest}
209230 * @returns A Promise of Token
@@ -243,7 +264,7 @@ export class API extends ParentAPI {
243264 )
244265
245266 /**
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.
247268 *
248269 * @param request - The request {@link ListTokensRequest}
249270 * @returns A Promise of ListTokensResponse
@@ -252,7 +273,7 @@ export class API extends ParentAPI {
252273 enrichForPagination ( 'tokens' , this . pageOfListTokens , request )
253274
254275 /**
255- * Get a token. Retrieve the token associated with the specified token ID.
276+ * Retrieve the token associated with the specified token ID.
256277 *
257278 * @param request - The request {@link GetTokenRequest}
258279 * @returns A Promise of Token
@@ -270,7 +291,7 @@ export class API extends ParentAPI {
270291 )
271292
272293 /**
273- * Delete a token. Delete the token associated with the specified token ID.
294+ * Delete the token associated with the specified token ID.
274295 *
275296 * @param request - The request {@link DeleteTokenRequest}
276297 */
@@ -284,8 +305,7 @@ export class API extends ParentAPI {
284305 } )
285306
286307 /**
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.
289309 *
290310 * @param request - The request {@link CreateContactPointRequest}
291311 * @returns A Promise of ContactPoint
@@ -326,8 +346,8 @@ export class API extends ParentAPI {
326346 )
327347
328348 /**
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.
331351 *
332352 * @param request - The request {@link ListContactPointsRequest}
333353 * @returns A Promise of ListContactPointsResponse
@@ -336,8 +356,7 @@ export class API extends ParentAPI {
336356 enrichForPagination ( 'contactPoints' , this . pageOfListContactPoints , request )
337357
338358 /**
339- * Delete an alert contact point. Delete a contact point for the default
340- * receiver.
359+ * Delete a contact point for the default receiver.
341360 *
342361 * @param request - The request {@link DeleteContactPointRequest}
343362 */
@@ -352,8 +371,7 @@ export class API extends ParentAPI {
352371 } )
353372
354373 /**
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.
357375 *
358376 * @param request - The request {@link EnableManagedAlertsRequest}
359377 */
@@ -368,8 +386,7 @@ export class API extends ParentAPI {
368386 } )
369387
370388 /**
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.
373390 *
374391 * @param request - The request {@link DisableManagedAlertsRequest}
375392 */
@@ -386,8 +403,7 @@ export class API extends ParentAPI {
386403 } )
387404
388405 /**
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.
391407 *
392408 * @param request - The request {@link TriggerTestAlertRequest}
393409 */
@@ -402,9 +418,8 @@ export class API extends ParentAPI {
402418 } )
403419
404420 /**
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.
408423 *
409424 * @param request - The request {@link CreateGrafanaUserRequest}
410425 * @returns A Promise of GrafanaUser
@@ -446,8 +461,8 @@ export class API extends ParentAPI {
446461 )
447462
448463 /**
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.
451466 *
452467 * @param request - The request {@link ListGrafanaUsersRequest}
453468 * @returns A Promise of ListGrafanaUsersResponse
@@ -456,8 +471,8 @@ export class API extends ParentAPI {
456471 enrichForPagination ( 'grafanaUsers' , this . pageOfListGrafanaUsers , request )
457472
458473 /**
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.
461476 *
462477 * @param request - The request {@link DeleteGrafanaUserRequest}
463478 */
@@ -475,8 +490,8 @@ export class API extends ParentAPI {
475490 } )
476491
477492 /**
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.
480495 *
481496 * @param request - The request {@link ResetGrafanaUserPasswordRequest}
482497 * @returns A Promise of GrafanaUser
@@ -517,7 +532,7 @@ export class API extends ParentAPI {
517532 )
518533
519534 /**
520- * List pricing plans. Get a list of all pricing plans available.
535+ * Get a list of all pricing plans available.
521536 *
522537 * @param request - The request {@link ListPlansRequest}
523538 * @returns A Promise of ListPlansResponse
@@ -526,9 +541,8 @@ export class API extends ParentAPI {
526541 enrichForPagination ( 'plans' , this . pageOfListPlans , request )
527542
528543 /**
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.
532546 *
533547 * @param request - The request {@link SelectPlanRequest}
534548 * @returns A Promise of SelectPlanResponse
0 commit comments