@scaleway/sdk-cockpit 2.2.2 → 2.3.0

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.
@@ -1,758 +1,537 @@
1
- import { API, toApiLocality, validatePathParam, urlParams, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
1
  import { EXPORTER_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { unmarshalGetConfigResponse, marshalRegionalApiCreateExporterRequest, unmarshalExporter, unmarshalListExportersResponse, marshalRegionalApiUpdateExporterRequest, marshalRegionalApiCreateDataSourceRequest, unmarshalDataSource, unmarshalListDataSourcesResponse, marshalRegionalApiUpdateDataSourceRequest, unmarshalUsageOverview, marshalRegionalApiCreateTokenRequest, unmarshalToken, unmarshalListTokensResponse, unmarshalListProductsResponse, unmarshalAlertManager, marshalRegionalApiEnableAlertManagerRequest, marshalRegionalApiDisableAlertManagerRequest, unmarshalGetRulesCountResponse, marshalRegionalApiCreateContactPointRequest, unmarshalContactPoint, unmarshalListContactPointsResponse, marshalRegionalApiUpdateContactPointRequest, marshalRegionalApiDeleteContactPointRequest, unmarshalListAlertsResponse, marshalRegionalApiEnableManagedAlertsRequest, marshalRegionalApiDisableManagedAlertsRequest, marshalRegionalApiEnableAlertRulesRequest, unmarshalEnableAlertRulesResponse, marshalRegionalApiDisableAlertRulesRequest, unmarshalDisableAlertRulesResponse, marshalRegionalApiTriggerTestAlertRequest, unmarshalGrafana, marshalGlobalApiSyncGrafanaDataSourcesRequest, marshalGlobalApiCreateGrafanaUserRequest, unmarshalGrafanaUser, unmarshalListGrafanaUsersResponse, marshalGlobalApiResetGrafanaUserPasswordRequest, unmarshalListGrafanaProductDashboardsResponse, unmarshalGrafanaProductDashboard, unmarshalListPlansResponse, marshalGlobalApiSelectPlanRequest, unmarshalPlan } from "./marshalling.gen.js";
4
- const jsonContentHeaders = {
5
- "Content-Type": "application/json; charset=utf-8"
2
+ import { marshalGlobalApiCreateGrafanaUserRequest, marshalGlobalApiResetGrafanaUserPasswordRequest, marshalGlobalApiSelectPlanRequest, marshalGlobalApiSyncGrafanaDataSourcesRequest, marshalRegionalApiCreateContactPointRequest, marshalRegionalApiCreateDataSourceRequest, marshalRegionalApiCreateExporterRequest, marshalRegionalApiCreateTokenRequest, marshalRegionalApiDeleteContactPointRequest, marshalRegionalApiDisableAlertManagerRequest, marshalRegionalApiDisableAlertRulesRequest, marshalRegionalApiDisableManagedAlertsRequest, marshalRegionalApiEnableAlertManagerRequest, marshalRegionalApiEnableAlertRulesRequest, marshalRegionalApiEnableManagedAlertsRequest, marshalRegionalApiTriggerTestAlertRequest, marshalRegionalApiUpdateContactPointRequest, marshalRegionalApiUpdateDataSourceRequest, marshalRegionalApiUpdateExporterRequest, unmarshalAlertManager, unmarshalContactPoint, unmarshalDataSource, unmarshalDisableAlertRulesResponse, unmarshalEnableAlertRulesResponse, unmarshalExporter, unmarshalGetConfigResponse, unmarshalGetRulesCountResponse, unmarshalGrafana, unmarshalGrafanaProductDashboard, unmarshalGrafanaUser, unmarshalListAlertsResponse, unmarshalListContactPointsResponse, unmarshalListDataSourcesResponse, unmarshalListExportersResponse, unmarshalListGrafanaProductDashboardsResponse, unmarshalListGrafanaUsersResponse, unmarshalListPlansResponse, unmarshalListProductsResponse, unmarshalListTokensResponse, unmarshalPlan, unmarshalToken, unmarshalUsageOverview } from "./marshalling.gen.js";
3
+ import { API, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * Cockpit Global API.
7
+
8
+ The Cockpit Global API allows you to manage your Cockpit's Grafana.
9
+ */
10
+ var GlobalAPI = class extends API {
11
+ /**
12
+ * Get your Cockpit's Grafana. Retrieve information on your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to.
13
+ The output returned displays the URL to access your Cockpit's Grafana.
14
+ *
15
+ * @param request - The request {@link GlobalApiGetGrafanaRequest}
16
+ * @returns A Promise of Grafana
17
+ */
18
+ getGrafana = (request = {}) => this.client.fetch({
19
+ method: "GET",
20
+ path: `/cockpit/v1/grafana`,
21
+ urlParams: urlParams(["project_id", request.projectId ?? this.client.settings.defaultProjectId])
22
+ }, unmarshalGrafana);
23
+ /**
24
+ * 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.
25
+ *
26
+ * @param request - The request {@link GlobalApiSyncGrafanaDataSourcesRequest}
27
+ */
28
+ syncGrafanaDataSources = (request = {}) => this.client.fetch({
29
+ body: JSON.stringify(marshalGlobalApiSyncGrafanaDataSourcesRequest(request, this.client.settings)),
30
+ headers: jsonContentHeaders,
31
+ method: "POST",
32
+ path: `/cockpit/v1/grafana/sync-data-sources`
33
+ });
34
+ /**
35
+ * (Deprecated) EOL 2026-01-20. Create a Grafana user
36
+ 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.
37
+ 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.
38
+ *
39
+ * @deprecated
40
+ * @param request - The request {@link GlobalApiCreateGrafanaUserRequest}
41
+ * @returns A Promise of GrafanaUser
42
+ */
43
+ createGrafanaUser = (request) => this.client.fetch({
44
+ body: JSON.stringify(marshalGlobalApiCreateGrafanaUserRequest(request, this.client.settings)),
45
+ headers: jsonContentHeaders,
46
+ method: "POST",
47
+ path: `/cockpit/v1/grafana/users`
48
+ }, unmarshalGrafanaUser);
49
+ pageOfListGrafanaUsers = (request = {}) => this.client.fetch({
50
+ method: "GET",
51
+ path: `/cockpit/v1/grafana/users`,
52
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId])
53
+ }, unmarshalListGrafanaUsersResponse);
54
+ /**
55
+ * (Deprecated) EOL 2026-01-20. List Grafana users
56
+ List all Grafana users created in your Cockpit's Grafana. By default, the Grafana users returned in the list are ordered in ascending order.
57
+ *
58
+ * @deprecated
59
+ * @param request - The request {@link GlobalApiListGrafanaUsersRequest}
60
+ * @returns A Promise of ListGrafanaUsersResponse
61
+ */
62
+ listGrafanaUsers = (request = {}) => enrichForPagination("grafanaUsers", this.pageOfListGrafanaUsers, request);
63
+ /**
64
+ * (Deprecated) EOL 2026-01-20. Delete a Grafana user
65
+ 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.
66
+ *
67
+ * @deprecated
68
+ * @param request - The request {@link GlobalApiDeleteGrafanaUserRequest}
69
+ */
70
+ deleteGrafanaUser = (request) => this.client.fetch({
71
+ method: "DELETE",
72
+ path: `/cockpit/v1/grafana/users/${validatePathParam("grafanaUserId", request.grafanaUserId)}`,
73
+ urlParams: urlParams(["project_id", request.projectId ?? this.client.settings.defaultProjectId])
74
+ });
75
+ /**
76
+ * (Deprecated) EOL 2026-01-20. Reset a Grafana user password
77
+ 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.
78
+ A new password regenerates and only displays once. Make sure that you save it.
79
+ *
80
+ * @deprecated
81
+ * @param request - The request {@link GlobalApiResetGrafanaUserPasswordRequest}
82
+ * @returns A Promise of GrafanaUser
83
+ */
84
+ resetGrafanaUserPassword = (request) => this.client.fetch({
85
+ body: JSON.stringify(marshalGlobalApiResetGrafanaUserPasswordRequest(request, this.client.settings)),
86
+ headers: jsonContentHeaders,
87
+ method: "POST",
88
+ path: `/cockpit/v1/grafana/users/${validatePathParam("grafanaUserId", request.grafanaUserId)}/reset-password`
89
+ }, unmarshalGrafanaUser);
90
+ pageOfListGrafanaProductDashboards = (request = {}) => this.client.fetch({
91
+ method: "GET",
92
+ path: `/cockpit/v1/grafana/product-dashboards`,
93
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId], ["tags", request.tags])
94
+ }, unmarshalListGrafanaProductDashboardsResponse);
95
+ /**
96
+ * List Scaleway resources dashboards. Retrieve a list of available dashboards in Grafana, for all Scaleway resources which are integrated with Cockpit.
97
+ *
98
+ * @param request - The request {@link GlobalApiListGrafanaProductDashboardsRequest}
99
+ * @returns A Promise of ListGrafanaProductDashboardsResponse
100
+ */
101
+ listGrafanaProductDashboards = (request = {}) => enrichForPagination("dashboards", this.pageOfListGrafanaProductDashboards, request);
102
+ /**
103
+ * 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.
104
+ *
105
+ * @param request - The request {@link GlobalApiGetGrafanaProductDashboardRequest}
106
+ * @returns A Promise of GrafanaProductDashboard
107
+ */
108
+ getGrafanaProductDashboard = (request) => this.client.fetch({
109
+ method: "GET",
110
+ path: `/cockpit/v1/grafana/product-dashboards/${validatePathParam("dashboardName", request.dashboardName)}`,
111
+ urlParams: urlParams(["project_id", request.projectId ?? this.client.settings.defaultProjectId])
112
+ }, unmarshalGrafanaProductDashboard);
113
+ pageOfListPlans = (request = {}) => this.client.fetch({
114
+ method: "GET",
115
+ path: `/cockpit/v1/plans`,
116
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
117
+ }, unmarshalListPlansResponse);
118
+ /**
119
+ * List plan types. Retrieve a list of available pricing plan types.
120
+ Deprecated due to retention now being managed at the data source level.
121
+ *
122
+ * @deprecated
123
+ * @param request - The request {@link GlobalApiListPlansRequest}
124
+ * @returns A Promise of ListPlansResponse
125
+ */
126
+ listPlans = (request = {}) => enrichForPagination("plans", this.pageOfListPlans, request);
127
+ /**
128
+ * 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.
129
+ Deprecated due to retention now being managed at the data source level.
130
+ *
131
+ * @deprecated
132
+ * @param request - The request {@link GlobalApiSelectPlanRequest}
133
+ * @returns A Promise of Plan
134
+ */
135
+ selectPlan = (request = {}) => this.client.fetch({
136
+ body: JSON.stringify(marshalGlobalApiSelectPlanRequest(request, this.client.settings)),
137
+ headers: jsonContentHeaders,
138
+ method: "PATCH",
139
+ path: `/cockpit/v1/plans`
140
+ }, unmarshalPlan);
141
+ /**
142
+ * Get current plan. Retrieve a pricing plan for the given Project, specified by the ID of the Project.
143
+ Deprecated due to retention now being managed at the data source level.
144
+ *
145
+ * @deprecated
146
+ * @param request - The request {@link GlobalApiGetCurrentPlanRequest}
147
+ * @returns A Promise of Plan
148
+ */
149
+ getCurrentPlan = (request = {}) => this.client.fetch({
150
+ method: "GET",
151
+ path: `/cockpit/v1/current-plan`,
152
+ urlParams: urlParams(["project_id", request.projectId ?? this.client.settings.defaultProjectId])
153
+ }, unmarshalPlan);
6
154
  };
7
- class GlobalAPI extends API {
8
- /**
9
- * Get your Cockpit's Grafana. Retrieve information on your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to.
10
- The output returned displays the URL to access your Cockpit's Grafana.
11
- *
12
- * @param request - The request {@link GlobalApiGetGrafanaRequest}
13
- * @returns A Promise of Grafana
14
- */
15
- getGrafana = (request = {}) => this.client.fetch(
16
- {
17
- method: "GET",
18
- path: `/cockpit/v1/grafana`,
19
- urlParams: urlParams(
20
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
21
- )
22
- },
23
- unmarshalGrafana
24
- );
25
- /**
26
- * 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.
27
- *
28
- * @param request - The request {@link GlobalApiSyncGrafanaDataSourcesRequest}
29
- */
30
- syncGrafanaDataSources = (request = {}) => this.client.fetch(
31
- {
32
- body: JSON.stringify(
33
- marshalGlobalApiSyncGrafanaDataSourcesRequest(request, this.client.settings)
34
- ),
35
- headers: jsonContentHeaders,
36
- method: "POST",
37
- path: `/cockpit/v1/grafana/sync-data-sources`
38
- }
39
- );
40
- /**
41
- * (Deprecated) EOL 2026-01-20. Create a Grafana user
42
- 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.
43
- 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.
44
- *
45
- * @deprecated
46
- * @param request - The request {@link GlobalApiCreateGrafanaUserRequest}
47
- * @returns A Promise of GrafanaUser
48
- */
49
- createGrafanaUser = (request) => this.client.fetch(
50
- {
51
- body: JSON.stringify(
52
- marshalGlobalApiCreateGrafanaUserRequest(request, this.client.settings)
53
- ),
54
- headers: jsonContentHeaders,
55
- method: "POST",
56
- path: `/cockpit/v1/grafana/users`
57
- },
58
- unmarshalGrafanaUser
59
- );
60
- pageOfListGrafanaUsers = (request = {}) => this.client.fetch(
61
- {
62
- method: "GET",
63
- path: `/cockpit/v1/grafana/users`,
64
- urlParams: urlParams(
65
- ["order_by", request.orderBy],
66
- ["page", request.page],
67
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
68
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
69
- )
70
- },
71
- unmarshalListGrafanaUsersResponse
72
- );
73
- /**
74
- * (Deprecated) EOL 2026-01-20. List Grafana users
75
- List all Grafana users created in your Cockpit's Grafana. By default, the Grafana users returned in the list are ordered in ascending order.
76
- *
77
- * @deprecated
78
- * @param request - The request {@link GlobalApiListGrafanaUsersRequest}
79
- * @returns A Promise of ListGrafanaUsersResponse
80
- */
81
- listGrafanaUsers = (request = {}) => enrichForPagination("grafanaUsers", this.pageOfListGrafanaUsers, request);
82
- /**
83
- * (Deprecated) EOL 2026-01-20. Delete a Grafana user
84
- 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.
85
- *
86
- * @deprecated
87
- * @param request - The request {@link GlobalApiDeleteGrafanaUserRequest}
88
- */
89
- deleteGrafanaUser = (request) => this.client.fetch(
90
- {
91
- method: "DELETE",
92
- path: `/cockpit/v1/grafana/users/${validatePathParam("grafanaUserId", request.grafanaUserId)}`,
93
- urlParams: urlParams(
94
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
95
- )
96
- }
97
- );
98
- /**
99
- * (Deprecated) EOL 2026-01-20. Reset a Grafana user password
100
- 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.
101
- A new password regenerates and only displays once. Make sure that you save it.
102
- *
103
- * @deprecated
104
- * @param request - The request {@link GlobalApiResetGrafanaUserPasswordRequest}
105
- * @returns A Promise of GrafanaUser
106
- */
107
- resetGrafanaUserPassword = (request) => this.client.fetch(
108
- {
109
- body: JSON.stringify(
110
- marshalGlobalApiResetGrafanaUserPasswordRequest(request, this.client.settings)
111
- ),
112
- headers: jsonContentHeaders,
113
- method: "POST",
114
- path: `/cockpit/v1/grafana/users/${validatePathParam("grafanaUserId", request.grafanaUserId)}/reset-password`
115
- },
116
- unmarshalGrafanaUser
117
- );
118
- pageOfListGrafanaProductDashboards = (request = {}) => this.client.fetch(
119
- {
120
- method: "GET",
121
- path: `/cockpit/v1/grafana/product-dashboards`,
122
- urlParams: urlParams(
123
- ["page", request.page],
124
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
125
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId],
126
- ["tags", request.tags]
127
- )
128
- },
129
- unmarshalListGrafanaProductDashboardsResponse
130
- );
131
- /**
132
- * List Scaleway resources dashboards. Retrieve a list of available dashboards in Grafana, for all Scaleway resources which are integrated with Cockpit.
133
- *
134
- * @param request - The request {@link GlobalApiListGrafanaProductDashboardsRequest}
135
- * @returns A Promise of ListGrafanaProductDashboardsResponse
136
- */
137
- listGrafanaProductDashboards = (request = {}) => enrichForPagination("dashboards", this.pageOfListGrafanaProductDashboards, request);
138
- /**
139
- * 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.
140
- *
141
- * @param request - The request {@link GlobalApiGetGrafanaProductDashboardRequest}
142
- * @returns A Promise of GrafanaProductDashboard
143
- */
144
- getGrafanaProductDashboard = (request) => this.client.fetch(
145
- {
146
- method: "GET",
147
- path: `/cockpit/v1/grafana/product-dashboards/${validatePathParam("dashboardName", request.dashboardName)}`,
148
- urlParams: urlParams(
149
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
150
- )
151
- },
152
- unmarshalGrafanaProductDashboard
153
- );
154
- pageOfListPlans = (request = {}) => this.client.fetch(
155
- {
156
- method: "GET",
157
- path: `/cockpit/v1/plans`,
158
- urlParams: urlParams(
159
- ["order_by", request.orderBy],
160
- ["page", request.page],
161
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
162
- )
163
- },
164
- unmarshalListPlansResponse
165
- );
166
- /**
167
- * List plan types. Retrieve a list of available pricing plan types.
168
- Deprecated due to retention now being managed at the data source level.
169
- *
170
- * @deprecated
171
- * @param request - The request {@link GlobalApiListPlansRequest}
172
- * @returns A Promise of ListPlansResponse
173
- */
174
- listPlans = (request = {}) => enrichForPagination("plans", this.pageOfListPlans, request);
175
- /**
176
- * 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.
177
- Deprecated due to retention now being managed at the data source level.
178
- *
179
- * @deprecated
180
- * @param request - The request {@link GlobalApiSelectPlanRequest}
181
- * @returns A Promise of Plan
182
- */
183
- selectPlan = (request = {}) => this.client.fetch(
184
- {
185
- body: JSON.stringify(
186
- marshalGlobalApiSelectPlanRequest(request, this.client.settings)
187
- ),
188
- headers: jsonContentHeaders,
189
- method: "PATCH",
190
- path: `/cockpit/v1/plans`
191
- },
192
- unmarshalPlan
193
- );
194
- /**
195
- * Get current plan. Retrieve a pricing plan for the given Project, specified by the ID of the Project.
196
- Deprecated due to retention now being managed at the data source level.
197
- *
198
- * @deprecated
199
- * @param request - The request {@link GlobalApiGetCurrentPlanRequest}
200
- * @returns A Promise of Plan
201
- */
202
- getCurrentPlan = (request = {}) => this.client.fetch(
203
- {
204
- method: "GET",
205
- path: `/cockpit/v1/current-plan`,
206
- urlParams: urlParams(
207
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
208
- )
209
- },
210
- unmarshalPlan
211
- );
212
- }
213
- class RegionalAPI extends API {
214
- /**
215
- * Locality of this API.
216
- * type ∈ {'zone','region','global','unspecified'}
217
- */
218
- static LOCALITY = toApiLocality({
219
- regions: [
220
- "fr-par",
221
- "nl-ams",
222
- "pl-waw"
223
- ]
224
- });
225
- /**
226
- * Get the Cockpit configuration.
227
- *
228
- * @param request - The request {@link RegionalApiGetConfigRequest}
229
- * @returns A Promise of GetConfigResponse
230
- */
231
- getConfig = (request = {}) => this.client.fetch(
232
- {
233
- method: "GET",
234
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/config`
235
- },
236
- unmarshalGetConfigResponse
237
- );
238
- /**
239
- * Create a data export. Create an export to send your metrics/logs from a Scaleway data source to an external destination.
240
- Current supported destination for data exports are Datadog and OTLP endpoints.
241
- This feature is in Beta phase. During Beta phase, exporter can take up to 30 min to be effectively active.
242
- *
243
- * @param request - The request {@link RegionalApiCreateExporterRequest}
244
- * @returns A Promise of Exporter
245
- */
246
- createExporter = (request) => this.client.fetch(
247
- {
248
- body: JSON.stringify(
249
- marshalRegionalApiCreateExporterRequest(request, this.client.settings)
250
- ),
251
- headers: jsonContentHeaders,
252
- method: "POST",
253
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters`
254
- },
255
- unmarshalExporter
256
- );
257
- pageOfListExporters = (request = {}) => this.client.fetch(
258
- {
259
- method: "GET",
260
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters`,
261
- urlParams: urlParams(
262
- ["datasource_id", request.datasourceId],
263
- ["order_by", request.orderBy],
264
- ["page", request.page],
265
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
266
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
267
- )
268
- },
269
- unmarshalListExportersResponse
270
- );
271
- /**
272
- * List data exports. List all data exports within a given Scaleway Project, specified by its ID.
273
- Optionally, specify a Scaleway data source ID to retrieve only data exports associated with that data source.
274
- *
275
- * @param request - The request {@link RegionalApiListExportersRequest}
276
- * @returns A Promise of ListExportersResponse
277
- */
278
- listExporters = (request = {}) => enrichForPagination("exporters", this.pageOfListExporters, request);
279
- /**
280
- * Get a data export. Retrieve information about a given data export, specified by its ID.
281
- *
282
- * @param request - The request {@link RegionalApiGetExporterRequest}
283
- * @returns A Promise of Exporter
284
- */
285
- getExporter = (request) => this.client.fetch(
286
- {
287
- method: "GET",
288
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters/${validatePathParam("exporterId", request.exporterId)}`
289
- },
290
- unmarshalExporter
291
- );
292
- /**
293
- * Waits for {@link Exporter} to be in a final state.
294
- *
295
- * @param request - The request {@link RegionalApiGetExporterRequest}
296
- * @param options - The waiting options
297
- * @returns A Promise of Exporter
298
- */
299
- waitForExporter = (request, options) => waitForResource(
300
- options?.stop ?? ((res) => Promise.resolve(!EXPORTER_TRANSIENT_STATUSES.includes(res.status))),
301
- this.getExporter,
302
- request,
303
- options
304
- );
305
- /**
306
- * Delete a data export. Delete a given data export, specified by its ID.
307
- Note that this action will immediately and permanently delete this data exports.
308
- *
309
- * @param request - The request {@link RegionalApiDeleteExporterRequest}
310
- */
311
- deleteExporter = (request) => this.client.fetch(
312
- {
313
- method: "DELETE",
314
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters/${validatePathParam("exporterId", request.exporterId)}`
315
- }
316
- );
317
- /**
318
- * Update a data export. Update a data export attributes. Changes are effective immediately even during Beta phase.
319
- Note that you can not change the data source linked to the export. If you need to do so, you will need to re-create the export.
320
- *
321
- * @param request - The request {@link RegionalApiUpdateExporterRequest}
322
- * @returns A Promise of Exporter
323
- */
324
- updateExporter = (request) => this.client.fetch(
325
- {
326
- body: JSON.stringify(
327
- marshalRegionalApiUpdateExporterRequest(request, this.client.settings)
328
- ),
329
- headers: jsonContentHeaders,
330
- method: "PATCH",
331
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters/${validatePathParam("exporterId", request.exporterId)}`
332
- },
333
- unmarshalExporter
334
- );
335
- /**
336
- * Create a data source. You must specify the data source name and type (metrics, logs, traces) upon creation.
337
- The name of the data source will then be used as reference to name the associated Grafana data source.
338
- *
339
- * @param request - The request {@link RegionalApiCreateDataSourceRequest}
340
- * @returns A Promise of DataSource
341
- */
342
- createDataSource = (request) => this.client.fetch(
343
- {
344
- body: JSON.stringify(
345
- marshalRegionalApiCreateDataSourceRequest(request, this.client.settings)
346
- ),
347
- headers: jsonContentHeaders,
348
- method: "POST",
349
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources`
350
- },
351
- unmarshalDataSource
352
- );
353
- /**
354
- * 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.
355
- *
356
- * @param request - The request {@link RegionalApiGetDataSourceRequest}
357
- * @returns A Promise of DataSource
358
- */
359
- getDataSource = (request) => this.client.fetch(
360
- {
361
- method: "GET",
362
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources/${validatePathParam("dataSourceId", request.dataSourceId)}`
363
- },
364
- unmarshalDataSource
365
- );
366
- /**
367
- * Delete a data source. Delete a given data source. Note that this action will permanently delete this data source and any data associated with it.
368
- *
369
- * @param request - The request {@link RegionalApiDeleteDataSourceRequest}
370
- */
371
- deleteDataSource = (request) => this.client.fetch(
372
- {
373
- method: "DELETE",
374
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources/${validatePathParam("dataSourceId", request.dataSourceId)}`
375
- }
376
- );
377
- pageOfListDataSources = (request = {}) => this.client.fetch(
378
- {
379
- method: "GET",
380
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources`,
381
- urlParams: urlParams(
382
- ["order_by", request.orderBy],
383
- ["origin", request.origin],
384
- ["page", request.page],
385
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
386
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId],
387
- ["types", request.types]
388
- )
389
- },
390
- unmarshalListDataSourcesResponse
391
- );
392
- /**
393
- * 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.
394
- *
395
- * @param request - The request {@link RegionalApiListDataSourcesRequest}
396
- * @returns A Promise of ListDataSourcesResponse
397
- */
398
- listDataSources = (request = {}) => enrichForPagination("dataSources", this.pageOfListDataSources, request);
399
- /**
400
- * Update a data source. Update a given data source attributes (name and/or retention_days).
401
- *
402
- * @param request - The request {@link RegionalApiUpdateDataSourceRequest}
403
- * @returns A Promise of DataSource
404
- */
405
- updateDataSource = (request) => this.client.fetch(
406
- {
407
- body: JSON.stringify(
408
- marshalRegionalApiUpdateDataSourceRequest(request, this.client.settings)
409
- ),
410
- headers: jsonContentHeaders,
411
- method: "PATCH",
412
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources/${validatePathParam("dataSourceId", request.dataSourceId)}`
413
- },
414
- unmarshalDataSource
415
- );
416
- /**
417
- * Get data source usage overview. Retrieve the volume of data ingested for each of your data sources in the specified project and region.
418
- *
419
- * @param request - The request {@link RegionalApiGetUsageOverviewRequest}
420
- * @returns A Promise of UsageOverview
421
- */
422
- getUsageOverview = (request = {}) => this.client.fetch(
423
- {
424
- method: "GET",
425
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/usage-overview`,
426
- urlParams: urlParams(
427
- ["interval", request.interval],
428
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
429
- )
430
- },
431
- unmarshalUsageOverview
432
- );
433
- /**
434
- * 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.
435
- Upon creation, your token's secret key display only once. Make sure that you save it.
436
- *
437
- * @param request - The request {@link RegionalApiCreateTokenRequest}
438
- * @returns A Promise of Token
439
- */
440
- createToken = (request) => this.client.fetch(
441
- {
442
- body: JSON.stringify(
443
- marshalRegionalApiCreateTokenRequest(request, this.client.settings)
444
- ),
445
- headers: jsonContentHeaders,
446
- method: "POST",
447
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`
448
- },
449
- unmarshalToken
450
- );
451
- pageOfListTokens = (request = {}) => this.client.fetch(
452
- {
453
- method: "GET",
454
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`,
455
- urlParams: urlParams(
456
- ["order_by", request.orderBy],
457
- ["page", request.page],
458
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
459
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId],
460
- ["token_scopes", request.tokenScopes]
461
- )
462
- },
463
- unmarshalListTokensResponse
464
- );
465
- /**
466
- * 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.
467
- You can filter tokens by Project ID and token scopes.
468
- *
469
- * @param request - The request {@link RegionalApiListTokensRequest}
470
- * @returns A Promise of ListTokensResponse
471
- */
472
- listTokens = (request = {}) => enrichForPagination("tokens", this.pageOfListTokens, request);
473
- /**
474
- * Get a token. Retrieve information about a given token, specified by the token ID. The token's information such as its scopes, is returned.
475
- *
476
- * @param request - The request {@link RegionalApiGetTokenRequest}
477
- * @returns A Promise of Token
478
- */
479
- getToken = (request) => this.client.fetch(
480
- {
481
- method: "GET",
482
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${validatePathParam("tokenId", request.tokenId)}`
483
- },
484
- unmarshalToken
485
- );
486
- /**
487
- * Delete a token. Delete a given token, specified by the token ID. Deleting a token is irreversible and cannot be undone.
488
- *
489
- * @param request - The request {@link RegionalApiDeleteTokenRequest}
490
- */
491
- deleteToken = (request) => this.client.fetch(
492
- {
493
- method: "DELETE",
494
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${validatePathParam("tokenId", request.tokenId)}`
495
- }
496
- );
497
- pageOfListProducts = (request = {}) => this.client.fetch(
498
- {
499
- method: "GET",
500
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/products`,
501
- urlParams: urlParams(
502
- ["order_by", request.orderBy],
503
- ["page", request.page],
504
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
505
- )
506
- },
507
- unmarshalListProductsResponse
508
- );
509
- /**
510
- * List Scaleway products. List all Scaleway products that send metrics and/or logs to Cockpit.
511
- Note that all of those products send at least metrics, but only a subset send logs to Cockpit.
512
- For more information, see https://www.scaleway.com/en/docs/cockpit/reference-content/cockpit-product-integration/.
513
- *
514
- * @param request - The request {@link RegionalApiListProductsRequest}
515
- * @returns A Promise of ListProductsResponse
516
- */
517
- listProducts = (request = {}) => enrichForPagination("productsList", this.pageOfListProducts, request);
518
- /**
519
- * Get the Alert manager. Retrieve information about the Alert manager which is unique per Project and region. By default the Alert manager is disabled.
520
- The output returned displays a URL to access the Alert manager, and whether the Alert manager and managed alerts are enabled.
521
- *
522
- * @param request - The request {@link RegionalApiGetAlertManagerRequest}
523
- * @returns A Promise of AlertManager
524
- */
525
- getAlertManager = (request = {}) => this.client.fetch(
526
- {
527
- method: "GET",
528
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager`,
529
- urlParams: urlParams(
530
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
531
- )
532
- },
533
- unmarshalAlertManager
534
- );
535
- /**
536
- * 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.
537
- *
538
- * @param request - The request {@link RegionalApiEnableAlertManagerRequest}
539
- * @returns A Promise of AlertManager
540
- */
541
- enableAlertManager = (request = {}) => this.client.fetch(
542
- {
543
- body: JSON.stringify(
544
- marshalRegionalApiEnableAlertManagerRequest(request, this.client.settings)
545
- ),
546
- headers: jsonContentHeaders,
547
- method: "POST",
548
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/enable`
549
- },
550
- unmarshalAlertManager
551
- );
552
- /**
553
- * 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.
554
- *
555
- * @param request - The request {@link RegionalApiDisableAlertManagerRequest}
556
- * @returns A Promise of AlertManager
557
- */
558
- disableAlertManager = (request = {}) => this.client.fetch(
559
- {
560
- body: JSON.stringify(
561
- marshalRegionalApiDisableAlertManagerRequest(request, this.client.settings)
562
- ),
563
- headers: jsonContentHeaders,
564
- method: "POST",
565
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/disable`
566
- },
567
- unmarshalAlertManager
568
- );
569
- /**
570
- * 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.
571
- *
572
- * @param request - The request {@link RegionalApiGetRulesCountRequest}
573
- * @returns A Promise of GetRulesCountResponse
574
- */
575
- getRulesCount = (request = {}) => this.client.fetch(
576
- {
577
- method: "GET",
578
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/rules/count`,
579
- urlParams: urlParams(
580
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
581
- )
582
- },
583
- unmarshalGetRulesCountResponse
584
- );
585
- /**
586
- * Create a contact point. Contact points are email addresses associated with the default receiver, that the Alert manager sends alerts to.
587
- The source of the alerts are data sources within the same Project and region as the Alert manager.
588
- 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.
589
- *
590
- * @param request - The request {@link RegionalApiCreateContactPointRequest}
591
- * @returns A Promise of ContactPoint
592
- */
593
- createContactPoint = (request = {}) => this.client.fetch(
594
- {
595
- body: JSON.stringify(
596
- marshalRegionalApiCreateContactPointRequest(request, this.client.settings)
597
- ),
598
- headers: jsonContentHeaders,
599
- method: "POST",
600
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points`
601
- },
602
- unmarshalContactPoint
603
- );
604
- pageOfListContactPoints = (request = {}) => this.client.fetch(
605
- {
606
- method: "GET",
607
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points`,
608
- urlParams: urlParams(
609
- ["page", request.page],
610
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
611
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
612
- )
613
- },
614
- unmarshalListContactPointsResponse
615
- );
616
- /**
617
- * 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.
618
- *
619
- * @param request - The request {@link RegionalApiListContactPointsRequest}
620
- * @returns A Promise of ListContactPointsResponse
621
- */
622
- listContactPoints = (request = {}) => enrichForPagination("contactPoints", this.pageOfListContactPoints, request);
623
- updateContactPoint = (request = {}) => this.client.fetch(
624
- {
625
- body: JSON.stringify(
626
- marshalRegionalApiUpdateContactPointRequest(request, this.client.settings)
627
- ),
628
- headers: jsonContentHeaders,
629
- method: "PATCH",
630
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points`
631
- },
632
- unmarshalContactPoint
633
- );
634
- /**
635
- * Delete a contact point. Delete a contact point associated with the default receiver.
636
- *
637
- * @param request - The request {@link RegionalApiDeleteContactPointRequest}
638
- */
639
- deleteContactPoint = (request = {}) => this.client.fetch(
640
- {
641
- body: JSON.stringify(
642
- marshalRegionalApiDeleteContactPointRequest(request, this.client.settings)
643
- ),
644
- headers: jsonContentHeaders,
645
- method: "POST",
646
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points/delete`
647
- }
648
- );
649
- /**
650
- * List alerts. List preconfigured and/or custom alerts for the specified Project and data source.
651
- *
652
- * @param request - The request {@link RegionalApiListAlertsRequest}
653
- * @returns A Promise of ListAlertsResponse
654
- */
655
- listAlerts = (request = {}) => this.client.fetch(
656
- {
657
- method: "GET",
658
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alerts`,
659
- urlParams: urlParams(
660
- ["data_source_id", request.dataSourceId],
661
- ["is_preconfigured", request.isPreconfigured],
662
- ["project_id", request.projectId ?? this.client.settings.defaultProjectId],
663
- ["rule_status", request.ruleStatus],
664
- ["state", request.state]
665
- )
666
- },
667
- unmarshalListAlertsResponse
668
- );
669
- /**
670
- * 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.
671
- *
672
- * @deprecated
673
- * @param request - The request {@link RegionalApiEnableManagedAlertsRequest}
674
- * @returns A Promise of AlertManager
675
- */
676
- enableManagedAlerts = (request = {}) => this.client.fetch(
677
- {
678
- body: JSON.stringify(
679
- marshalRegionalApiEnableManagedAlertsRequest(request, this.client.settings)
680
- ),
681
- headers: jsonContentHeaders,
682
- method: "POST",
683
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/managed-alerts/enable`
684
- },
685
- unmarshalAlertManager
686
- );
687
- /**
688
- * Disable managed alerts. Disable the sending of managed alerts for the specified Project.
689
- *
690
- * @deprecated
691
- * @param request - The request {@link RegionalApiDisableManagedAlertsRequest}
692
- * @returns A Promise of AlertManager
693
- */
694
- disableManagedAlerts = (request = {}) => this.client.fetch(
695
- {
696
- body: JSON.stringify(
697
- marshalRegionalApiDisableManagedAlertsRequest(request, this.client.settings)
698
- ),
699
- headers: jsonContentHeaders,
700
- method: "POST",
701
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/managed-alerts/disable`
702
- },
703
- unmarshalAlertManager
704
- );
705
- /**
706
- * Enable preconfigured alert rules. Enable alert rules from the list of available preconfigured rules.
707
- *
708
- * @param request - The request {@link RegionalApiEnableAlertRulesRequest}
709
- * @returns A Promise of EnableAlertRulesResponse
710
- */
711
- enableAlertRules = (request = {}) => this.client.fetch(
712
- {
713
- body: JSON.stringify(
714
- marshalRegionalApiEnableAlertRulesRequest(request, this.client.settings)
715
- ),
716
- headers: jsonContentHeaders,
717
- method: "POST",
718
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/enable-alert-rules`
719
- },
720
- unmarshalEnableAlertRulesResponse
721
- );
722
- /**
723
- * Disable preconfigured alert rules. Disable alert rules from the list of available preconfigured rules.
724
- *
725
- * @param request - The request {@link RegionalApiDisableAlertRulesRequest}
726
- * @returns A Promise of DisableAlertRulesResponse
727
- */
728
- disableAlertRules = (request = {}) => this.client.fetch(
729
- {
730
- body: JSON.stringify(
731
- marshalRegionalApiDisableAlertRulesRequest(request, this.client.settings)
732
- ),
733
- headers: jsonContentHeaders,
734
- method: "POST",
735
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/disable-alert-rules`
736
- },
737
- unmarshalDisableAlertRulesResponse
738
- );
739
- /**
740
- * Trigger a test alert. Send a test alert to the Alert manager to make sure your contact points get notified.
741
- *
742
- * @param request - The request {@link RegionalApiTriggerTestAlertRequest}
743
- */
744
- triggerTestAlert = (request = {}) => this.client.fetch(
745
- {
746
- body: JSON.stringify(
747
- marshalRegionalApiTriggerTestAlertRequest(request, this.client.settings)
748
- ),
749
- headers: jsonContentHeaders,
750
- method: "POST",
751
- path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/trigger-test-alert`
752
- }
753
- );
754
- }
755
- export {
756
- GlobalAPI,
757
- RegionalAPI
155
+ /**
156
+ * Cockpit API.
157
+
158
+ The Cockpit API allows you to create data sources and Cockpit tokens to store and query data types such as metrics, logs, and traces. You can also push your data into Cockpit, and send alerts to your contact points when your resources may require your attention, using the regional Alert manager.
159
+ */
160
+ var RegionalAPI = class extends API {
161
+ /**
162
+ * Locality of this API.
163
+ * type {'zone','region','global','unspecified'}
164
+ */
165
+ static LOCALITY = toApiLocality({ regions: [
166
+ "fr-par",
167
+ "nl-ams",
168
+ "pl-waw"
169
+ ] });
170
+ /**
171
+ * Get the Cockpit configuration.
172
+ *
173
+ * @param request - The request {@link RegionalApiGetConfigRequest}
174
+ * @returns A Promise of GetConfigResponse
175
+ */
176
+ getConfig = (request = {}) => this.client.fetch({
177
+ method: "GET",
178
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/config`
179
+ }, unmarshalGetConfigResponse);
180
+ /**
181
+ * Create a data export. Create an export to send your metrics/logs from a Scaleway data source to an external destination.
182
+ Current supported destination for data exports are Datadog and OTLP endpoints.
183
+ This feature is in Beta phase. During Beta phase, exporter can take up to 30 min to be effectively active.
184
+ *
185
+ * @param request - The request {@link RegionalApiCreateExporterRequest}
186
+ * @returns A Promise of Exporter
187
+ */
188
+ createExporter = (request) => this.client.fetch({
189
+ body: JSON.stringify(marshalRegionalApiCreateExporterRequest(request, this.client.settings)),
190
+ headers: jsonContentHeaders,
191
+ method: "POST",
192
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters`
193
+ }, unmarshalExporter);
194
+ pageOfListExporters = (request = {}) => this.client.fetch({
195
+ method: "GET",
196
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters`,
197
+ urlParams: urlParams(["datasource_id", request.datasourceId], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId])
198
+ }, unmarshalListExportersResponse);
199
+ /**
200
+ * List data exports. List all data exports within a given Scaleway Project, specified by its ID.
201
+ Optionally, specify a Scaleway data source ID to retrieve only data exports associated with that data source.
202
+ *
203
+ * @param request - The request {@link RegionalApiListExportersRequest}
204
+ * @returns A Promise of ListExportersResponse
205
+ */
206
+ listExporters = (request = {}) => enrichForPagination("exporters", this.pageOfListExporters, request);
207
+ /**
208
+ * Get a data export. Retrieve information about a given data export, specified by its ID.
209
+ *
210
+ * @param request - The request {@link RegionalApiGetExporterRequest}
211
+ * @returns A Promise of Exporter
212
+ */
213
+ getExporter = (request) => this.client.fetch({
214
+ method: "GET",
215
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters/${validatePathParam("exporterId", request.exporterId)}`
216
+ }, unmarshalExporter);
217
+ /**
218
+ * Waits for {@link Exporter} to be in a final state.
219
+ *
220
+ * @param request - The request {@link RegionalApiGetExporterRequest}
221
+ * @param options - The waiting options
222
+ * @returns A Promise of Exporter
223
+ */
224
+ waitForExporter = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!EXPORTER_TRANSIENT_STATUSES.includes(res.status))), this.getExporter, request, options);
225
+ /**
226
+ * Delete a data export. Delete a given data export, specified by its ID.
227
+ Note that this action will immediately and permanently delete this data exports.
228
+ *
229
+ * @param request - The request {@link RegionalApiDeleteExporterRequest}
230
+ */
231
+ deleteExporter = (request) => this.client.fetch({
232
+ method: "DELETE",
233
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters/${validatePathParam("exporterId", request.exporterId)}`
234
+ });
235
+ /**
236
+ * Update a data export. Update a data export attributes. Changes are effective immediately even during Beta phase.
237
+ Note that you can not change the data source linked to the export. If you need to do so, you will need to re-create the export.
238
+ *
239
+ * @param request - The request {@link RegionalApiUpdateExporterRequest}
240
+ * @returns A Promise of Exporter
241
+ */
242
+ updateExporter = (request) => this.client.fetch({
243
+ body: JSON.stringify(marshalRegionalApiUpdateExporterRequest(request, this.client.settings)),
244
+ headers: jsonContentHeaders,
245
+ method: "PATCH",
246
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/exporters/${validatePathParam("exporterId", request.exporterId)}`
247
+ }, unmarshalExporter);
248
+ /**
249
+ * Create a data source. You must specify the data source name and type (metrics, logs, traces) upon creation.
250
+ The name of the data source will then be used as reference to name the associated Grafana data source.
251
+ *
252
+ * @param request - The request {@link RegionalApiCreateDataSourceRequest}
253
+ * @returns A Promise of DataSource
254
+ */
255
+ createDataSource = (request) => this.client.fetch({
256
+ body: JSON.stringify(marshalRegionalApiCreateDataSourceRequest(request, this.client.settings)),
257
+ headers: jsonContentHeaders,
258
+ method: "POST",
259
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources`
260
+ }, unmarshalDataSource);
261
+ /**
262
+ * 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.
263
+ *
264
+ * @param request - The request {@link RegionalApiGetDataSourceRequest}
265
+ * @returns A Promise of DataSource
266
+ */
267
+ getDataSource = (request) => this.client.fetch({
268
+ method: "GET",
269
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources/${validatePathParam("dataSourceId", request.dataSourceId)}`
270
+ }, unmarshalDataSource);
271
+ /**
272
+ * Delete a data source. Delete a given data source. Note that this action will permanently delete this data source and any data associated with it.
273
+ *
274
+ * @param request - The request {@link RegionalApiDeleteDataSourceRequest}
275
+ */
276
+ deleteDataSource = (request) => this.client.fetch({
277
+ method: "DELETE",
278
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources/${validatePathParam("dataSourceId", request.dataSourceId)}`
279
+ });
280
+ pageOfListDataSources = (request = {}) => this.client.fetch({
281
+ method: "GET",
282
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources`,
283
+ urlParams: urlParams(["order_by", request.orderBy], ["origin", request.origin], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId], ["types", request.types])
284
+ }, unmarshalListDataSourcesResponse);
285
+ /**
286
+ * 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.
287
+ *
288
+ * @param request - The request {@link RegionalApiListDataSourcesRequest}
289
+ * @returns A Promise of ListDataSourcesResponse
290
+ */
291
+ listDataSources = (request = {}) => enrichForPagination("dataSources", this.pageOfListDataSources, request);
292
+ /**
293
+ * Update a data source. Update a given data source attributes (name and/or retention_days).
294
+ *
295
+ * @param request - The request {@link RegionalApiUpdateDataSourceRequest}
296
+ * @returns A Promise of DataSource
297
+ */
298
+ updateDataSource = (request) => this.client.fetch({
299
+ body: JSON.stringify(marshalRegionalApiUpdateDataSourceRequest(request, this.client.settings)),
300
+ headers: jsonContentHeaders,
301
+ method: "PATCH",
302
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/data-sources/${validatePathParam("dataSourceId", request.dataSourceId)}`
303
+ }, unmarshalDataSource);
304
+ /**
305
+ * Get data source usage overview. Retrieve the volume of data ingested for each of your data sources in the specified project and region.
306
+ *
307
+ * @param request - The request {@link RegionalApiGetUsageOverviewRequest}
308
+ * @returns A Promise of UsageOverview
309
+ */
310
+ getUsageOverview = (request = {}) => this.client.fetch({
311
+ method: "GET",
312
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/usage-overview`,
313
+ urlParams: urlParams(["interval", request.interval], ["project_id", request.projectId ?? this.client.settings.defaultProjectId])
314
+ }, unmarshalUsageOverview);
315
+ /**
316
+ * 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.
317
+ Upon creation, your token's secret key display only once. Make sure that you save it.
318
+ *
319
+ * @param request - The request {@link RegionalApiCreateTokenRequest}
320
+ * @returns A Promise of Token
321
+ */
322
+ createToken = (request) => this.client.fetch({
323
+ body: JSON.stringify(marshalRegionalApiCreateTokenRequest(request, this.client.settings)),
324
+ headers: jsonContentHeaders,
325
+ method: "POST",
326
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`
327
+ }, unmarshalToken);
328
+ pageOfListTokens = (request = {}) => this.client.fetch({
329
+ method: "GET",
330
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`,
331
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId], ["token_scopes", request.tokenScopes])
332
+ }, unmarshalListTokensResponse);
333
+ /**
334
+ * 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.
335
+ You can filter tokens by Project ID and token scopes.
336
+ *
337
+ * @param request - The request {@link RegionalApiListTokensRequest}
338
+ * @returns A Promise of ListTokensResponse
339
+ */
340
+ listTokens = (request = {}) => enrichForPagination("tokens", this.pageOfListTokens, request);
341
+ /**
342
+ * Get a token. Retrieve information about a given token, specified by the token ID. The token's information such as its scopes, is returned.
343
+ *
344
+ * @param request - The request {@link RegionalApiGetTokenRequest}
345
+ * @returns A Promise of Token
346
+ */
347
+ getToken = (request) => this.client.fetch({
348
+ method: "GET",
349
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${validatePathParam("tokenId", request.tokenId)}`
350
+ }, unmarshalToken);
351
+ /**
352
+ * Delete a token. Delete a given token, specified by the token ID. Deleting a token is irreversible and cannot be undone.
353
+ *
354
+ * @param request - The request {@link RegionalApiDeleteTokenRequest}
355
+ */
356
+ deleteToken = (request) => this.client.fetch({
357
+ method: "DELETE",
358
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${validatePathParam("tokenId", request.tokenId)}`
359
+ });
360
+ pageOfListProducts = (request = {}) => this.client.fetch({
361
+ method: "GET",
362
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/products`,
363
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
364
+ }, unmarshalListProductsResponse);
365
+ /**
366
+ * List Scaleway products. List all Scaleway products that send metrics and/or logs to Cockpit.
367
+ Note that all of those products send at least metrics, but only a subset send logs to Cockpit.
368
+ For more information, see https://www.scaleway.com/en/docs/cockpit/reference-content/cockpit-product-integration/.
369
+ *
370
+ * @param request - The request {@link RegionalApiListProductsRequest}
371
+ * @returns A Promise of ListProductsResponse
372
+ */
373
+ listProducts = (request = {}) => enrichForPagination("productsList", this.pageOfListProducts, request);
374
+ /**
375
+ * Get the Alert manager. Retrieve information about the Alert manager which is unique per Project and region. By default the Alert manager is disabled.
376
+ The output returned displays a URL to access the Alert manager, and whether the Alert manager and managed alerts are enabled.
377
+ *
378
+ * @param request - The request {@link RegionalApiGetAlertManagerRequest}
379
+ * @returns A Promise of AlertManager
380
+ */
381
+ getAlertManager = (request = {}) => this.client.fetch({
382
+ method: "GET",
383
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager`,
384
+ urlParams: urlParams(["project_id", request.projectId ?? this.client.settings.defaultProjectId])
385
+ }, unmarshalAlertManager);
386
+ /**
387
+ * 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.
388
+ *
389
+ * @param request - The request {@link RegionalApiEnableAlertManagerRequest}
390
+ * @returns A Promise of AlertManager
391
+ */
392
+ enableAlertManager = (request = {}) => this.client.fetch({
393
+ body: JSON.stringify(marshalRegionalApiEnableAlertManagerRequest(request, this.client.settings)),
394
+ headers: jsonContentHeaders,
395
+ method: "POST",
396
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/enable`
397
+ }, unmarshalAlertManager);
398
+ /**
399
+ * 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.
400
+ *
401
+ * @param request - The request {@link RegionalApiDisableAlertManagerRequest}
402
+ * @returns A Promise of AlertManager
403
+ */
404
+ disableAlertManager = (request = {}) => this.client.fetch({
405
+ body: JSON.stringify(marshalRegionalApiDisableAlertManagerRequest(request, this.client.settings)),
406
+ headers: jsonContentHeaders,
407
+ method: "POST",
408
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/disable`
409
+ }, unmarshalAlertManager);
410
+ /**
411
+ * 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.
412
+ *
413
+ * @param request - The request {@link RegionalApiGetRulesCountRequest}
414
+ * @returns A Promise of GetRulesCountResponse
415
+ */
416
+ getRulesCount = (request = {}) => this.client.fetch({
417
+ method: "GET",
418
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/rules/count`,
419
+ urlParams: urlParams(["project_id", request.projectId ?? this.client.settings.defaultProjectId])
420
+ }, unmarshalGetRulesCountResponse);
421
+ /**
422
+ * Create a contact point. Contact points are email addresses associated with the default receiver, that the Alert manager sends alerts to.
423
+ The source of the alerts are data sources within the same Project and region as the Alert manager.
424
+ 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.
425
+ *
426
+ * @param request - The request {@link RegionalApiCreateContactPointRequest}
427
+ * @returns A Promise of ContactPoint
428
+ */
429
+ createContactPoint = (request = {}) => this.client.fetch({
430
+ body: JSON.stringify(marshalRegionalApiCreateContactPointRequest(request, this.client.settings)),
431
+ headers: jsonContentHeaders,
432
+ method: "POST",
433
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points`
434
+ }, unmarshalContactPoint);
435
+ pageOfListContactPoints = (request = {}) => this.client.fetch({
436
+ method: "GET",
437
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points`,
438
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId])
439
+ }, unmarshalListContactPointsResponse);
440
+ /**
441
+ * 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.
442
+ *
443
+ * @param request - The request {@link RegionalApiListContactPointsRequest}
444
+ * @returns A Promise of ListContactPointsResponse
445
+ */
446
+ listContactPoints = (request = {}) => enrichForPagination("contactPoints", this.pageOfListContactPoints, request);
447
+ updateContactPoint = (request = {}) => this.client.fetch({
448
+ body: JSON.stringify(marshalRegionalApiUpdateContactPointRequest(request, this.client.settings)),
449
+ headers: jsonContentHeaders,
450
+ method: "PATCH",
451
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points`
452
+ }, unmarshalContactPoint);
453
+ /**
454
+ * Delete a contact point. Delete a contact point associated with the default receiver.
455
+ *
456
+ * @param request - The request {@link RegionalApiDeleteContactPointRequest}
457
+ */
458
+ deleteContactPoint = (request = {}) => this.client.fetch({
459
+ body: JSON.stringify(marshalRegionalApiDeleteContactPointRequest(request, this.client.settings)),
460
+ headers: jsonContentHeaders,
461
+ method: "POST",
462
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points/delete`
463
+ });
464
+ /**
465
+ * List alerts. List preconfigured and/or custom alerts for the specified Project and data source.
466
+ *
467
+ * @param request - The request {@link RegionalApiListAlertsRequest}
468
+ * @returns A Promise of ListAlertsResponse
469
+ */
470
+ listAlerts = (request = {}) => this.client.fetch({
471
+ method: "GET",
472
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alerts`,
473
+ urlParams: urlParams(["data_source_id", request.dataSourceId], ["is_preconfigured", request.isPreconfigured], ["project_id", request.projectId ?? this.client.settings.defaultProjectId], ["rule_status", request.ruleStatus], ["state", request.state])
474
+ }, unmarshalListAlertsResponse);
475
+ /**
476
+ * 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.
477
+ *
478
+ * @deprecated
479
+ * @param request - The request {@link RegionalApiEnableManagedAlertsRequest}
480
+ * @returns A Promise of AlertManager
481
+ */
482
+ enableManagedAlerts = (request = {}) => this.client.fetch({
483
+ body: JSON.stringify(marshalRegionalApiEnableManagedAlertsRequest(request, this.client.settings)),
484
+ headers: jsonContentHeaders,
485
+ method: "POST",
486
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/managed-alerts/enable`
487
+ }, unmarshalAlertManager);
488
+ /**
489
+ * Disable managed alerts. Disable the sending of managed alerts for the specified Project.
490
+ *
491
+ * @deprecated
492
+ * @param request - The request {@link RegionalApiDisableManagedAlertsRequest}
493
+ * @returns A Promise of AlertManager
494
+ */
495
+ disableManagedAlerts = (request = {}) => this.client.fetch({
496
+ body: JSON.stringify(marshalRegionalApiDisableManagedAlertsRequest(request, this.client.settings)),
497
+ headers: jsonContentHeaders,
498
+ method: "POST",
499
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/managed-alerts/disable`
500
+ }, unmarshalAlertManager);
501
+ /**
502
+ * Enable preconfigured alert rules. Enable alert rules from the list of available preconfigured rules.
503
+ *
504
+ * @param request - The request {@link RegionalApiEnableAlertRulesRequest}
505
+ * @returns A Promise of EnableAlertRulesResponse
506
+ */
507
+ enableAlertRules = (request = {}) => this.client.fetch({
508
+ body: JSON.stringify(marshalRegionalApiEnableAlertRulesRequest(request, this.client.settings)),
509
+ headers: jsonContentHeaders,
510
+ method: "POST",
511
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/enable-alert-rules`
512
+ }, unmarshalEnableAlertRulesResponse);
513
+ /**
514
+ * Disable preconfigured alert rules. Disable alert rules from the list of available preconfigured rules.
515
+ *
516
+ * @param request - The request {@link RegionalApiDisableAlertRulesRequest}
517
+ * @returns A Promise of DisableAlertRulesResponse
518
+ */
519
+ disableAlertRules = (request = {}) => this.client.fetch({
520
+ body: JSON.stringify(marshalRegionalApiDisableAlertRulesRequest(request, this.client.settings)),
521
+ headers: jsonContentHeaders,
522
+ method: "POST",
523
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/disable-alert-rules`
524
+ }, unmarshalDisableAlertRulesResponse);
525
+ /**
526
+ * Trigger a test alert. Send a test alert to the Alert manager to make sure your contact points get notified.
527
+ *
528
+ * @param request - The request {@link RegionalApiTriggerTestAlertRequest}
529
+ */
530
+ triggerTestAlert = (request = {}) => this.client.fetch({
531
+ body: JSON.stringify(marshalRegionalApiTriggerTestAlertRequest(request, this.client.settings)),
532
+ headers: jsonContentHeaders,
533
+ method: "POST",
534
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/trigger-test-alert`
535
+ });
758
536
  };
537
+ export { GlobalAPI, RegionalAPI };