@scaleway/sdk-cockpit 1.6.0 → 2.1.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/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-cockpit
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-cockpit.svg)](https://www.npmjs.com/package/@scaleway/sdk-cockpit)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-cockpit.svg)](https://www.npmjs.com/package/@scaleway/sdk-cockpit)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-cockpit.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Cockpit API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-cockpit @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-cockpit @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-cockpit @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Cockpit } from '@scaleway/sdk-cockpit'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Cockpit.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Cockpit } from '@scaleway/sdk-cockpit'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Cockpit.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Cockpit API Documentation](https://www.scaleway.com/en/developers/api/cockpit/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
+
89
+ ## Contributing
90
+
91
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
92
+
93
+ ## License
94
+
95
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
+
@@ -1,6 +1,6 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality } from '@scaleway/sdk-client';
3
- import type { AlertManager, ContactPoint, DataSource, DisableAlertRulesResponse, EnableAlertRulesResponse, GetConfigResponse, GetRulesCountResponse, GlobalApiCreateGrafanaUserRequest, GlobalApiDeleteGrafanaUserRequest, GlobalApiGetCurrentPlanRequest, GlobalApiGetGrafanaProductDashboardRequest, GlobalApiGetGrafanaRequest, GlobalApiListGrafanaProductDashboardsRequest, GlobalApiListGrafanaUsersRequest, GlobalApiListPlansRequest, GlobalApiResetGrafanaUserPasswordRequest, GlobalApiSelectPlanRequest, GlobalApiSyncGrafanaDataSourcesRequest, Grafana, GrafanaProductDashboard, GrafanaUser, ListAlertsResponse, ListContactPointsResponse, ListDataSourcesResponse, ListGrafanaProductDashboardsResponse, ListGrafanaUsersResponse, ListPlansResponse, ListTokensResponse, Plan, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, RegionalApiDeleteContactPointRequest, RegionalApiDeleteDataSourceRequest, RegionalApiDeleteTokenRequest, RegionalApiDisableAlertManagerRequest, RegionalApiDisableAlertRulesRequest, RegionalApiEnableAlertManagerRequest, RegionalApiEnableAlertRulesRequest, RegionalApiGetAlertManagerRequest, RegionalApiGetConfigRequest, RegionalApiGetDataSourceRequest, RegionalApiGetRulesCountRequest, RegionalApiGetTokenRequest, RegionalApiGetUsageOverviewRequest, RegionalApiListAlertsRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, RegionalApiListTokensRequest, RegionalApiTriggerTestAlertRequest, RegionalApiUpdateContactPointRequest, RegionalApiUpdateDataSourceRequest, Token, UsageOverview } from './types.gen.js';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
+ import type { AlertManager, ContactPoint, DataSource, DisableAlertRulesResponse, EnableAlertRulesResponse, GetConfigResponse, GetRulesCountResponse, GlobalApiCreateGrafanaUserRequest, GlobalApiDeleteGrafanaUserRequest, GlobalApiGetCurrentPlanRequest, GlobalApiGetGrafanaProductDashboardRequest, GlobalApiGetGrafanaRequest, GlobalApiListGrafanaProductDashboardsRequest, GlobalApiListGrafanaUsersRequest, GlobalApiListPlansRequest, GlobalApiResetGrafanaUserPasswordRequest, GlobalApiSelectPlanRequest, GlobalApiSyncGrafanaDataSourcesRequest, Grafana, GrafanaProductDashboard, GrafanaUser, ListAlertsResponse, ListContactPointsResponse, ListDataSourcesResponse, ListGrafanaProductDashboardsResponse, ListGrafanaUsersResponse, ListPlansResponse, ListProductsResponse, ListTokensResponse, Plan, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, RegionalApiDeleteContactPointRequest, RegionalApiDeleteDataSourceRequest, RegionalApiDeleteTokenRequest, RegionalApiDisableAlertManagerRequest, RegionalApiDisableAlertRulesRequest, RegionalApiDisableManagedAlertsRequest, RegionalApiEnableAlertManagerRequest, RegionalApiEnableAlertRulesRequest, RegionalApiEnableManagedAlertsRequest, RegionalApiGetAlertManagerRequest, RegionalApiGetConfigRequest, RegionalApiGetDataSourceRequest, RegionalApiGetRulesCountRequest, RegionalApiGetTokenRequest, RegionalApiGetUsageOverviewRequest, RegionalApiListAlertsRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, RegionalApiListProductsRequest, RegionalApiListTokensRequest, RegionalApiTriggerTestAlertRequest, RegionalApiUpdateContactPointRequest, RegionalApiUpdateDataSourceRequest, Token, UsageOverview } from './types.gen.js';
4
4
  /**
5
5
  * Cockpit Global API.
6
6
 
@@ -22,17 +22,21 @@ export declare class GlobalAPI extends ParentAPI {
22
22
  */
23
23
  syncGrafanaDataSources: (request?: Readonly<GlobalApiSyncGrafanaDataSourcesRequest>) => Promise<void>;
24
24
  /**
25
- * 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.
25
+ * (Deprecated) EOL 2026-01-20. Create a Grafana user
26
+ 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.
26
27
  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.
27
28
  *
29
+ * @deprecated
28
30
  * @param request - The request {@link GlobalApiCreateGrafanaUserRequest}
29
31
  * @returns A Promise of GrafanaUser
30
32
  */
31
33
  createGrafanaUser: (request: Readonly<GlobalApiCreateGrafanaUserRequest>) => Promise<GrafanaUser>;
32
34
  protected pageOfListGrafanaUsers: (request?: Readonly<GlobalApiListGrafanaUsersRequest>) => Promise<ListGrafanaUsersResponse>;
33
35
  /**
34
- * 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.
36
+ * (Deprecated) EOL 2026-01-20. List Grafana users
37
+ List all Grafana users created in your Cockpit's Grafana. By default, the Grafana users returned in the list are ordered in ascending order.
35
38
  *
39
+ * @deprecated
36
40
  * @param request - The request {@link GlobalApiListGrafanaUsersRequest}
37
41
  * @returns A Promise of ListGrafanaUsersResponse
38
42
  */
@@ -41,15 +45,19 @@ export declare class GlobalAPI extends ParentAPI {
41
45
  [Symbol.asyncIterator]: () => AsyncGenerator<GrafanaUser[], void, void>;
42
46
  };
43
47
  /**
44
- * 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.
48
+ * (Deprecated) EOL 2026-01-20. Delete a Grafana user
49
+ 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.
45
50
  *
51
+ * @deprecated
46
52
  * @param request - The request {@link GlobalApiDeleteGrafanaUserRequest}
47
53
  */
48
54
  deleteGrafanaUser: (request: Readonly<GlobalApiDeleteGrafanaUserRequest>) => Promise<void>;
49
55
  /**
50
- * 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.
56
+ * (Deprecated) EOL 2026-01-20. Reset a Grafana user password
57
+ 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.
51
58
  A new password regenerates and only displays once. Make sure that you save it.
52
59
  *
60
+ * @deprecated
53
61
  * @param request - The request {@link GlobalApiResetGrafanaUserPasswordRequest}
54
62
  * @returns A Promise of GrafanaUser
55
63
  */
@@ -75,7 +83,7 @@ export declare class GlobalAPI extends ParentAPI {
75
83
  protected pageOfListPlans: (request?: Readonly<GlobalApiListPlansRequest>) => Promise<ListPlansResponse>;
76
84
  /**
77
85
  * List plan types. Retrieve a list of available pricing plan types.
78
- Deprecated: retention is now managed at the data source level.
86
+ Deprecated due to retention now being managed at the data source level.
79
87
  *
80
88
  * @deprecated
81
89
  * @param request - The request {@link GlobalApiListPlansRequest}
@@ -87,7 +95,7 @@ export declare class GlobalAPI extends ParentAPI {
87
95
  };
88
96
  /**
89
97
  * 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.
90
- Deprecated: retention is now managed at the data source level.
98
+ Deprecated due to retention now being managed at the data source level.
91
99
  *
92
100
  * @deprecated
93
101
  * @param request - The request {@link GlobalApiSelectPlanRequest}
@@ -96,7 +104,7 @@ export declare class GlobalAPI extends ParentAPI {
96
104
  selectPlan: (request?: Readonly<GlobalApiSelectPlanRequest>) => Promise<Plan>;
97
105
  /**
98
106
  * Get current plan. Retrieve a pricing plan for the given Project, specified by the ID of the Project.
99
- Deprecated: retention is now managed at the data source level.
107
+ Deprecated due to retention now being managed at the data source level.
100
108
  *
101
109
  * @deprecated
102
110
  * @param request - The request {@link GlobalApiGetCurrentPlanRequest}
@@ -201,6 +209,17 @@ export declare class RegionalAPI extends ParentAPI {
201
209
  * @param request - The request {@link RegionalApiDeleteTokenRequest}
202
210
  */
203
211
  deleteToken: (request: Readonly<RegionalApiDeleteTokenRequest>) => Promise<void>;
212
+ protected pageOfListProducts: (request?: Readonly<RegionalApiListProductsRequest>) => Promise<ListProductsResponse>;
213
+ /**
214
+ * List all Scaleway products that send metrics and/or logs to Cockpit.. List all Scaleway products that send metrics and/or logs to Cockpit.
215
+ *
216
+ * @param request - The request {@link RegionalApiListProductsRequest}
217
+ * @returns A Promise of ListProductsResponse
218
+ */
219
+ listProducts: (request?: Readonly<RegionalApiListProductsRequest>) => Promise<ListProductsResponse> & {
220
+ all: () => Promise<import("./types.gen.js").Product[]>;
221
+ [Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen.js").Product[], void, void>;
222
+ };
204
223
  /**
205
224
  * Get the Alert manager. Retrieve information about the Alert manager which is unique per Project and region. By default the Alert manager is disabled.
206
225
  The output returned displays a URL to access the Alert manager, and whether the Alert manager and managed alerts are enabled.
@@ -224,7 +243,7 @@ export declare class RegionalAPI extends ParentAPI {
224
243
  */
225
244
  disableAlertManager: (request?: Readonly<RegionalApiDisableAlertManagerRequest>) => Promise<AlertManager>;
226
245
  /**
227
- * Get the number of enabled rules Get a detailed count of enabled rules in the specified Project. Includes preconfigured and custom alerting and recording rules.. Get the number of enabled rules Get a detailed count of enabled rules in the specified Project. Includes preconfigured and custom alerting and recording rules.
246
+ * Get the number of enabled rules. Get a detailed count of enabled rules in the specified Project. Includes preconfigured and custom alerting and recording rules.
228
247
  *
229
248
  * @param request - The request {@link RegionalApiGetRulesCountRequest}
230
249
  * @returns A Promise of GetRulesCountResponse
@@ -264,6 +283,22 @@ export declare class RegionalAPI extends ParentAPI {
264
283
  * @returns A Promise of ListAlertsResponse
265
284
  */
266
285
  listAlerts: (request?: Readonly<RegionalApiListAlertsRequest>) => Promise<ListAlertsResponse>;
286
+ /**
287
+ * Enable managed alerts. Enable the sending of managed alerts for the specified Project. Managed alerts are predefined alerts that apply to Scaleway resources integrated with Cockpit by default.
288
+ *
289
+ * @deprecated
290
+ * @param request - The request {@link RegionalApiEnableManagedAlertsRequest}
291
+ * @returns A Promise of AlertManager
292
+ */
293
+ enableManagedAlerts: (request?: Readonly<RegionalApiEnableManagedAlertsRequest>) => Promise<AlertManager>;
294
+ /**
295
+ * Disable managed alerts. Disable the sending of managed alerts for the specified Project.
296
+ *
297
+ * @deprecated
298
+ * @param request - The request {@link RegionalApiDisableManagedAlertsRequest}
299
+ * @returns A Promise of AlertManager
300
+ */
301
+ disableManagedAlerts: (request?: Readonly<RegionalApiDisableManagedAlertsRequest>) => Promise<AlertManager>;
267
302
  /**
268
303
  * Enable preconfigured alert rules. Enable alert rules from the list of available preconfigured rules.
269
304
  *