@scaleway/sdk 2.34.0 → 2.35.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.
Files changed (46) hide show
  1. package/dist/api/baremetal/v1/api.gen.d.ts +1 -1
  2. package/dist/api/block/v1alpha1/api.gen.d.ts +1 -1
  3. package/dist/api/cockpit/v1/api.gen.cjs +26 -0
  4. package/dist/api/cockpit/v1/api.gen.d.ts +12 -1
  5. package/dist/api/cockpit/v1/api.gen.js +27 -1
  6. package/dist/api/cockpit/v1/index.gen.d.ts +1 -1
  7. package/dist/api/cockpit/v1/marshalling.gen.cjs +26 -0
  8. package/dist/api/cockpit/v1/marshalling.gen.d.ts +2 -1
  9. package/dist/api/cockpit/v1/marshalling.gen.js +26 -0
  10. package/dist/api/cockpit/v1/types.gen.d.ts +34 -0
  11. package/dist/api/cockpit/v1/validation-rules.gen.cjs +10 -0
  12. package/dist/api/cockpit/v1/validation-rules.gen.d.ts +9 -0
  13. package/dist/api/cockpit/v1/validation-rules.gen.js +10 -0
  14. package/dist/api/function/v1beta1/types.gen.d.ts +1 -1
  15. package/dist/api/instance/v1/api.utils.cjs +1 -2
  16. package/dist/api/instance/v1/api.utils.js +1 -2
  17. package/dist/api/tem/v1alpha1/marshalling.gen.cjs +1 -1
  18. package/dist/api/tem/v1alpha1/marshalling.gen.js +1 -1
  19. package/dist/api/tem/v1alpha1/types.gen.d.ts +1 -1
  20. package/dist/api/tem/v1alpha1/validation-rules.gen.cjs +64 -0
  21. package/dist/api/tem/v1alpha1/validation-rules.gen.d.ts +57 -0
  22. package/dist/api/tem/v1alpha1/validation-rules.gen.js +64 -0
  23. package/dist/helpers/marshalling.cjs +2 -4
  24. package/dist/helpers/marshalling.js +2 -4
  25. package/dist/internal/async/interval-retrier.cjs +2 -4
  26. package/dist/internal/async/interval-retrier.js +2 -4
  27. package/dist/scw/auth.cjs +2 -4
  28. package/dist/scw/auth.js +2 -4
  29. package/dist/scw/constants.cjs +1 -1
  30. package/dist/scw/constants.d.ts +2 -2
  31. package/dist/scw/constants.js +1 -1
  32. package/dist/scw/errors/standard/invalid-arguments-error.cjs +1 -2
  33. package/dist/scw/errors/standard/invalid-arguments-error.js +1 -2
  34. package/dist/scw/errors/standard/out-of-stock-error.cjs +1 -2
  35. package/dist/scw/errors/standard/out-of-stock-error.js +1 -2
  36. package/dist/scw/errors/standard/permissions-denied-error.cjs +1 -2
  37. package/dist/scw/errors/standard/permissions-denied-error.js +1 -2
  38. package/dist/scw/errors/standard/quotas-exceeded-error.cjs +1 -2
  39. package/dist/scw/errors/standard/quotas-exceeded-error.js +1 -2
  40. package/dist/scw/errors/standard/too-many-requests-error.cjs +1 -2
  41. package/dist/scw/errors/standard/too-many-requests-error.js +1 -2
  42. package/dist/scw/fetch/resource-paginator.cjs +1 -2
  43. package/dist/scw/fetch/resource-paginator.js +1 -2
  44. package/dist/scw/fetch/response-parser.cjs +2 -4
  45. package/dist/scw/fetch/response-parser.js +2 -4
  46. package/package.json +2 -2
@@ -245,7 +245,7 @@ export declare class API extends ParentAPI {
245
245
  */
246
246
  getOS: (request: Readonly<GetOSRequest>) => Promise<OS>;
247
247
  }
248
- /** Elastic Metal Private Network API. */
248
+ /** Elastic Metal - Private Network API. */
249
249
  export declare class PrivateNetworkAPI extends ParentAPI {
250
250
  /** Lists the available zones of the API. */
251
251
  static readonly LOCALITIES: Zone[];
@@ -2,7 +2,7 @@ import { API as ParentAPI } from '../../../bridge';
2
2
  import type { WaitForOptions, Zone } from '../../../bridge';
3
3
  import type { CreateSnapshotRequest, CreateVolumeRequest, DeleteSnapshotRequest, DeleteVolumeRequest, ExportSnapshotToObjectStorageRequest, GetSnapshotRequest, GetVolumeRequest, ImportSnapshotFromObjectStorageRequest, ImportSnapshotFromS3Request, ListSnapshotsRequest, ListSnapshotsResponse, ListVolumeTypesRequest, ListVolumeTypesResponse, ListVolumesRequest, ListVolumesResponse, Snapshot, UpdateSnapshotRequest, UpdateVolumeRequest, Volume } from './types.gen';
4
4
  /**
5
- * Scaleway Block Storage API.
5
+ * Block Storage API.
6
6
  *
7
7
  * This API allows you to manage your Block Storage volumes.
8
8
  */
@@ -564,6 +564,32 @@ class RegionalAPI extends api.API {
564
564
  method: "POST",
565
565
  path: `/cockpit/v1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points/delete`
566
566
  });
567
+ pageOfListManagedAlerts = (request = {}) => this.client.fetch(
568
+ {
569
+ method: "GET",
570
+ path: `/cockpit/v1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/managed-alerts`,
571
+ urlParams: marshalling.urlParams(
572
+ ["order_by", request.orderBy],
573
+ ["page", request.page],
574
+ [
575
+ "page_size",
576
+ request.pageSize ?? this.client.settings.defaultPageSize
577
+ ],
578
+ [
579
+ "project_id",
580
+ request.projectId ?? this.client.settings.defaultProjectId
581
+ ]
582
+ )
583
+ },
584
+ marshalling_gen.unmarshalListManagedAlertsResponse
585
+ );
586
+ /**
587
+ * List managed alerts. List all managed alerts for the specified Project.
588
+ *
589
+ * @param request - The request {@link RegionalApiListManagedAlertsRequest}
590
+ * @returns A Promise of ListManagedAlertsResponse
591
+ */
592
+ listManagedAlerts = (request = {}) => resourcePaginator.enrichForPagination("alerts", this.pageOfListManagedAlerts, request);
567
593
  /**
568
594
  * Enable managed alerts. Enable the sending of managed alerts for the
569
595
  * specified Project. Managed alerts are predefined alerts that apply to
@@ -1,6 +1,6 @@
1
1
  import { API as ParentAPI } from '../../../bridge';
2
2
  import type { Region } from '../../../bridge';
3
- import type { AlertManager, ContactPoint, DataSource, GlobalApiCreateGrafanaUserRequest, GlobalApiDeleteGrafanaUserRequest, GlobalApiGetCurrentPlanRequest, GlobalApiGetGrafanaProductDashboardRequest, GlobalApiGetGrafanaRequest, GlobalApiListGrafanaProductDashboardsRequest, GlobalApiListGrafanaUsersRequest, GlobalApiListPlansRequest, GlobalApiResetGrafanaUserPasswordRequest, GlobalApiSelectPlanRequest, GlobalApiSyncGrafanaDataSourcesRequest, Grafana, GrafanaProductDashboard, GrafanaUser, ListContactPointsResponse, ListDataSourcesResponse, ListGrafanaProductDashboardsResponse, ListGrafanaUsersResponse, ListPlansResponse, ListTokensResponse, Plan, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, RegionalApiDeleteContactPointRequest, RegionalApiDeleteDataSourceRequest, RegionalApiDeleteTokenRequest, RegionalApiDisableAlertManagerRequest, RegionalApiDisableManagedAlertsRequest, RegionalApiEnableAlertManagerRequest, RegionalApiEnableManagedAlertsRequest, RegionalApiGetAlertManagerRequest, RegionalApiGetDataSourceRequest, RegionalApiGetTokenRequest, RegionalApiGetUsageOverviewRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, RegionalApiListTokensRequest, RegionalApiTriggerTestAlertRequest, Token, UsageOverview } from './types.gen';
3
+ import type { AlertManager, ContactPoint, DataSource, GlobalApiCreateGrafanaUserRequest, GlobalApiDeleteGrafanaUserRequest, GlobalApiGetCurrentPlanRequest, GlobalApiGetGrafanaProductDashboardRequest, GlobalApiGetGrafanaRequest, GlobalApiListGrafanaProductDashboardsRequest, GlobalApiListGrafanaUsersRequest, GlobalApiListPlansRequest, GlobalApiResetGrafanaUserPasswordRequest, GlobalApiSelectPlanRequest, GlobalApiSyncGrafanaDataSourcesRequest, Grafana, GrafanaProductDashboard, GrafanaUser, ListContactPointsResponse, ListDataSourcesResponse, ListGrafanaProductDashboardsResponse, ListGrafanaUsersResponse, ListManagedAlertsResponse, ListPlansResponse, ListTokensResponse, Plan, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, RegionalApiDeleteContactPointRequest, RegionalApiDeleteDataSourceRequest, RegionalApiDeleteTokenRequest, RegionalApiDisableAlertManagerRequest, RegionalApiDisableManagedAlertsRequest, RegionalApiEnableAlertManagerRequest, RegionalApiEnableManagedAlertsRequest, RegionalApiGetAlertManagerRequest, RegionalApiGetDataSourceRequest, RegionalApiGetTokenRequest, RegionalApiGetUsageOverviewRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, RegionalApiListManagedAlertsRequest, RegionalApiListTokensRequest, RegionalApiTriggerTestAlertRequest, Token, UsageOverview } from './types.gen';
4
4
  /**
5
5
  * Cockpit Global API.
6
6
  *
@@ -283,6 +283,17 @@ export declare class RegionalAPI extends ParentAPI {
283
283
  * @param request - The request {@link RegionalApiDeleteContactPointRequest}
284
284
  */
285
285
  deleteContactPoint: (request?: Readonly<RegionalApiDeleteContactPointRequest>) => Promise<void>;
286
+ protected pageOfListManagedAlerts: (request?: Readonly<RegionalApiListManagedAlertsRequest>) => Promise<ListManagedAlertsResponse>;
287
+ /**
288
+ * List managed alerts. List all managed alerts for the specified Project.
289
+ *
290
+ * @param request - The request {@link RegionalApiListManagedAlertsRequest}
291
+ * @returns A Promise of ListManagedAlertsResponse
292
+ */
293
+ listManagedAlerts: (request?: Readonly<RegionalApiListManagedAlertsRequest>) => Promise<ListManagedAlertsResponse> & {
294
+ all: () => Promise<import("./types.gen").Alert[]>;
295
+ [Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen").Alert[], void, void>;
296
+ };
286
297
  /**
287
298
  * Enable managed alerts. Enable the sending of managed alerts for the
288
299
  * specified Project. Managed alerts are predefined alerts that apply to
@@ -1,7 +1,7 @@
1
1
  import { API as API$1 } from "../../../scw/api.js";
2
2
  import { urlParams, validatePathParam } from "../../../helpers/marshalling.js";
3
3
  import { enrichForPagination } from "../../../scw/fetch/resource-paginator.js";
4
- import { unmarshalGrafana, marshalGlobalApiSyncGrafanaDataSourcesRequest, marshalGlobalApiCreateGrafanaUserRequest, unmarshalGrafanaUser, unmarshalListGrafanaUsersResponse, marshalGlobalApiResetGrafanaUserPasswordRequest, unmarshalListGrafanaProductDashboardsResponse, unmarshalGrafanaProductDashboard, unmarshalListPlansResponse, marshalGlobalApiSelectPlanRequest, unmarshalPlan, marshalRegionalApiCreateDataSourceRequest, unmarshalDataSource, unmarshalListDataSourcesResponse, unmarshalUsageOverview, marshalRegionalApiCreateTokenRequest, unmarshalToken, unmarshalListTokensResponse, unmarshalAlertManager, marshalRegionalApiEnableAlertManagerRequest, marshalRegionalApiDisableAlertManagerRequest, marshalRegionalApiCreateContactPointRequest, unmarshalContactPoint, unmarshalListContactPointsResponse, marshalRegionalApiDeleteContactPointRequest, marshalRegionalApiEnableManagedAlertsRequest, marshalRegionalApiDisableManagedAlertsRequest, marshalRegionalApiTriggerTestAlertRequest } from "./marshalling.gen.js";
4
+ import { unmarshalGrafana, marshalGlobalApiSyncGrafanaDataSourcesRequest, marshalGlobalApiCreateGrafanaUserRequest, unmarshalGrafanaUser, unmarshalListGrafanaUsersResponse, marshalGlobalApiResetGrafanaUserPasswordRequest, unmarshalListGrafanaProductDashboardsResponse, unmarshalGrafanaProductDashboard, unmarshalListPlansResponse, marshalGlobalApiSelectPlanRequest, unmarshalPlan, marshalRegionalApiCreateDataSourceRequest, unmarshalDataSource, unmarshalListDataSourcesResponse, unmarshalUsageOverview, marshalRegionalApiCreateTokenRequest, unmarshalToken, unmarshalListTokensResponse, unmarshalAlertManager, marshalRegionalApiEnableAlertManagerRequest, marshalRegionalApiDisableAlertManagerRequest, marshalRegionalApiCreateContactPointRequest, unmarshalContactPoint, unmarshalListContactPointsResponse, marshalRegionalApiDeleteContactPointRequest, unmarshalListManagedAlertsResponse, marshalRegionalApiEnableManagedAlertsRequest, marshalRegionalApiDisableManagedAlertsRequest, marshalRegionalApiTriggerTestAlertRequest } from "./marshalling.gen.js";
5
5
  const jsonContentHeaders = {
6
6
  "Content-Type": "application/json; charset=utf-8"
7
7
  };
@@ -562,6 +562,32 @@ class RegionalAPI extends API$1 {
562
562
  method: "POST",
563
563
  path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/alert-manager/contact-points/delete`
564
564
  });
565
+ pageOfListManagedAlerts = (request = {}) => this.client.fetch(
566
+ {
567
+ method: "GET",
568
+ path: `/cockpit/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/managed-alerts`,
569
+ urlParams: urlParams(
570
+ ["order_by", request.orderBy],
571
+ ["page", request.page],
572
+ [
573
+ "page_size",
574
+ request.pageSize ?? this.client.settings.defaultPageSize
575
+ ],
576
+ [
577
+ "project_id",
578
+ request.projectId ?? this.client.settings.defaultProjectId
579
+ ]
580
+ )
581
+ },
582
+ unmarshalListManagedAlertsResponse
583
+ );
584
+ /**
585
+ * List managed alerts. List all managed alerts for the specified Project.
586
+ *
587
+ * @param request - The request {@link RegionalApiListManagedAlertsRequest}
588
+ * @returns A Promise of ListManagedAlertsResponse
589
+ */
590
+ listManagedAlerts = (request = {}) => enrichForPagination("alerts", this.pageOfListManagedAlerts, request);
565
591
  /**
566
592
  * Enable managed alerts. Enable the sending of managed alerts for the
567
593
  * specified Project. Managed alerts are predefined alerts that apply to
@@ -1,3 +1,3 @@
1
1
  export { GlobalAPI, RegionalAPI } from './api.gen';
2
- export type { AlertManager, ContactPoint, ContactPointEmail, DataSource, DataSourceOrigin, DataSourceType, GlobalApiCreateGrafanaUserRequest, GlobalApiDeleteGrafanaUserRequest, GlobalApiGetCurrentPlanRequest, GlobalApiGetGrafanaProductDashboardRequest, GlobalApiGetGrafanaRequest, GlobalApiListGrafanaProductDashboardsRequest, GlobalApiListGrafanaUsersRequest, GlobalApiListPlansRequest, GlobalApiResetGrafanaUserPasswordRequest, GlobalApiSelectPlanRequest, GlobalApiSyncGrafanaDataSourcesRequest, Grafana, GrafanaProductDashboard, GrafanaUser, GrafanaUserRole, ListContactPointsResponse, ListDataSourcesRequestOrderBy, ListDataSourcesResponse, ListGrafanaProductDashboardsResponse, ListGrafanaUsersRequestOrderBy, ListGrafanaUsersResponse, ListPlansRequestOrderBy, ListPlansResponse, ListTokensRequestOrderBy, ListTokensResponse, Plan, PlanName, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, RegionalApiDeleteContactPointRequest, RegionalApiDeleteDataSourceRequest, RegionalApiDeleteTokenRequest, RegionalApiDisableAlertManagerRequest, RegionalApiDisableManagedAlertsRequest, RegionalApiEnableAlertManagerRequest, RegionalApiEnableManagedAlertsRequest, RegionalApiGetAlertManagerRequest, RegionalApiGetDataSourceRequest, RegionalApiGetTokenRequest, RegionalApiGetUsageOverviewRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, RegionalApiListTokensRequest, RegionalApiTriggerTestAlertRequest, Token, TokenScope, Usage, UsageOverview, UsageUnit, } from './types.gen';
2
+ export type { Alert, AlertManager, ContactPoint, ContactPointEmail, DataSource, DataSourceOrigin, DataSourceType, GlobalApiCreateGrafanaUserRequest, GlobalApiDeleteGrafanaUserRequest, GlobalApiGetCurrentPlanRequest, GlobalApiGetGrafanaProductDashboardRequest, GlobalApiGetGrafanaRequest, GlobalApiListGrafanaProductDashboardsRequest, GlobalApiListGrafanaUsersRequest, GlobalApiListPlansRequest, GlobalApiResetGrafanaUserPasswordRequest, GlobalApiSelectPlanRequest, GlobalApiSyncGrafanaDataSourcesRequest, Grafana, GrafanaProductDashboard, GrafanaUser, GrafanaUserRole, ListContactPointsResponse, ListDataSourcesRequestOrderBy, ListDataSourcesResponse, ListGrafanaProductDashboardsResponse, ListGrafanaUsersRequestOrderBy, ListGrafanaUsersResponse, ListManagedAlertsRequestOrderBy, ListManagedAlertsResponse, ListPlansRequestOrderBy, ListPlansResponse, ListTokensRequestOrderBy, ListTokensResponse, Plan, PlanName, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, RegionalApiDeleteContactPointRequest, RegionalApiDeleteDataSourceRequest, RegionalApiDeleteTokenRequest, RegionalApiDisableAlertManagerRequest, RegionalApiDisableManagedAlertsRequest, RegionalApiEnableAlertManagerRequest, RegionalApiEnableManagedAlertsRequest, RegionalApiGetAlertManagerRequest, RegionalApiGetDataSourceRequest, RegionalApiGetTokenRequest, RegionalApiGetUsageOverviewRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, RegionalApiListManagedAlertsRequest, RegionalApiListTokensRequest, RegionalApiTriggerTestAlertRequest, Token, TokenScope, Usage, UsageOverview, UsageUnit, } from './types.gen';
3
3
  export * as ValidationRules from './validation-rules.gen';
@@ -181,6 +181,31 @@ const unmarshalListGrafanaUsersResponse = (data) => {
181
181
  totalCount: data.total_count
182
182
  };
183
183
  };
184
+ const unmarshalAlert = (data) => {
185
+ if (!json.isJSONObject(data)) {
186
+ throw new TypeError(
187
+ `Unmarshalling the type 'Alert' failed as data isn't a dictionary.`
188
+ );
189
+ }
190
+ return {
191
+ description: data.description,
192
+ name: data.name,
193
+ product: data.product,
194
+ productFamily: data.product_family,
195
+ rule: data.rule
196
+ };
197
+ };
198
+ const unmarshalListManagedAlertsResponse = (data) => {
199
+ if (!json.isJSONObject(data)) {
200
+ throw new TypeError(
201
+ `Unmarshalling the type 'ListManagedAlertsResponse' failed as data isn't a dictionary.`
202
+ );
203
+ }
204
+ return {
205
+ alerts: marshalling.unmarshalArrayOfObject(data.alerts, unmarshalAlert),
206
+ totalCount: data.total_count
207
+ };
208
+ };
184
209
  const unmarshalListPlansResponse = (data) => {
185
210
  if (!json.isJSONObject(data)) {
186
211
  throw new TypeError(
@@ -318,6 +343,7 @@ exports.unmarshalListContactPointsResponse = unmarshalListContactPointsResponse;
318
343
  exports.unmarshalListDataSourcesResponse = unmarshalListDataSourcesResponse;
319
344
  exports.unmarshalListGrafanaProductDashboardsResponse = unmarshalListGrafanaProductDashboardsResponse;
320
345
  exports.unmarshalListGrafanaUsersResponse = unmarshalListGrafanaUsersResponse;
346
+ exports.unmarshalListManagedAlertsResponse = unmarshalListManagedAlertsResponse;
321
347
  exports.unmarshalListPlansResponse = unmarshalListPlansResponse;
322
348
  exports.unmarshalListTokensResponse = unmarshalListTokensResponse;
323
349
  exports.unmarshalPlan = unmarshalPlan;
@@ -1,5 +1,5 @@
1
1
  import type { DefaultValues } from '../../../bridge';
2
- import type { AlertManager, ContactPoint, DataSource, GlobalApiCreateGrafanaUserRequest, GlobalApiResetGrafanaUserPasswordRequest, GlobalApiSelectPlanRequest, GlobalApiSyncGrafanaDataSourcesRequest, Grafana, GrafanaProductDashboard, GrafanaUser, ListContactPointsResponse, ListDataSourcesResponse, ListGrafanaProductDashboardsResponse, ListGrafanaUsersResponse, ListPlansResponse, ListTokensResponse, Plan, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, RegionalApiDeleteContactPointRequest, RegionalApiDisableAlertManagerRequest, RegionalApiDisableManagedAlertsRequest, RegionalApiEnableAlertManagerRequest, RegionalApiEnableManagedAlertsRequest, RegionalApiTriggerTestAlertRequest, Token, UsageOverview } from './types.gen';
2
+ import type { AlertManager, ContactPoint, DataSource, GlobalApiCreateGrafanaUserRequest, GlobalApiResetGrafanaUserPasswordRequest, GlobalApiSelectPlanRequest, GlobalApiSyncGrafanaDataSourcesRequest, Grafana, GrafanaProductDashboard, GrafanaUser, ListContactPointsResponse, ListDataSourcesResponse, ListGrafanaProductDashboardsResponse, ListGrafanaUsersResponse, ListManagedAlertsResponse, ListPlansResponse, ListTokensResponse, Plan, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, RegionalApiDeleteContactPointRequest, RegionalApiDisableAlertManagerRequest, RegionalApiDisableManagedAlertsRequest, RegionalApiEnableAlertManagerRequest, RegionalApiEnableManagedAlertsRequest, RegionalApiTriggerTestAlertRequest, Token, UsageOverview } from './types.gen';
3
3
  export declare const unmarshalContactPoint: (data: unknown) => ContactPoint;
4
4
  export declare const unmarshalDataSource: (data: unknown) => DataSource;
5
5
  export declare const unmarshalGrafanaProductDashboard: (data: unknown) => GrafanaProductDashboard;
@@ -12,6 +12,7 @@ export declare const unmarshalListContactPointsResponse: (data: unknown) => List
12
12
  export declare const unmarshalListDataSourcesResponse: (data: unknown) => ListDataSourcesResponse;
13
13
  export declare const unmarshalListGrafanaProductDashboardsResponse: (data: unknown) => ListGrafanaProductDashboardsResponse;
14
14
  export declare const unmarshalListGrafanaUsersResponse: (data: unknown) => ListGrafanaUsersResponse;
15
+ export declare const unmarshalListManagedAlertsResponse: (data: unknown) => ListManagedAlertsResponse;
15
16
  export declare const unmarshalListPlansResponse: (data: unknown) => ListPlansResponse;
16
17
  export declare const unmarshalListTokensResponse: (data: unknown) => ListTokensResponse;
17
18
  export declare const unmarshalUsageOverview: (data: unknown) => UsageOverview;
@@ -179,6 +179,31 @@ const unmarshalListGrafanaUsersResponse = (data) => {
179
179
  totalCount: data.total_count
180
180
  };
181
181
  };
182
+ const unmarshalAlert = (data) => {
183
+ if (!isJSONObject(data)) {
184
+ throw new TypeError(
185
+ `Unmarshalling the type 'Alert' failed as data isn't a dictionary.`
186
+ );
187
+ }
188
+ return {
189
+ description: data.description,
190
+ name: data.name,
191
+ product: data.product,
192
+ productFamily: data.product_family,
193
+ rule: data.rule
194
+ };
195
+ };
196
+ const unmarshalListManagedAlertsResponse = (data) => {
197
+ if (!isJSONObject(data)) {
198
+ throw new TypeError(
199
+ `Unmarshalling the type 'ListManagedAlertsResponse' failed as data isn't a dictionary.`
200
+ );
201
+ }
202
+ return {
203
+ alerts: unmarshalArrayOfObject(data.alerts, unmarshalAlert),
204
+ totalCount: data.total_count
205
+ };
206
+ };
182
207
  const unmarshalListPlansResponse = (data) => {
183
208
  if (!isJSONObject(data)) {
184
209
  throw new TypeError(
@@ -317,6 +342,7 @@ export {
317
342
  unmarshalListDataSourcesResponse,
318
343
  unmarshalListGrafanaProductDashboardsResponse,
319
344
  unmarshalListGrafanaUsersResponse,
345
+ unmarshalListManagedAlertsResponse,
320
346
  unmarshalListPlansResponse,
321
347
  unmarshalListTokensResponse,
322
348
  unmarshalPlan,
@@ -4,6 +4,7 @@ export type DataSourceType = 'unknown_type' | 'metrics' | 'logs' | 'traces';
4
4
  export type GrafanaUserRole = 'unknown_role' | 'editor' | 'viewer';
5
5
  export type ListDataSourcesRequestOrderBy = 'created_at_asc' | 'created_at_desc' | 'name_asc' | 'name_desc' | 'type_asc' | 'type_desc';
6
6
  export type ListGrafanaUsersRequestOrderBy = 'login_asc' | 'login_desc';
7
+ export type ListManagedAlertsRequestOrderBy = 'created_at_asc' | 'created_at_desc' | 'name_asc' | 'name_desc' | 'type_asc' | 'type_desc';
7
8
  export type ListPlansRequestOrderBy = 'name_asc' | 'name_desc';
8
9
  export type ListTokensRequestOrderBy = 'created_at_asc' | 'created_at_desc' | 'name_asc' | 'name_desc';
9
10
  export type PlanName = 'unknown_name' | 'free' | 'premium' | 'custom';
@@ -73,6 +74,13 @@ export interface GrafanaUser {
73
74
  /** Grafana user's password. */
74
75
  password?: string;
75
76
  }
77
+ export interface Alert {
78
+ productFamily: string;
79
+ product: string;
80
+ name: string;
81
+ rule: string;
82
+ description: string;
83
+ }
76
84
  /** Type of pricing plan. */
77
85
  export interface Plan {
78
86
  /** Name of a given pricing plan. */
@@ -272,6 +280,13 @@ export interface ListGrafanaUsersResponse {
272
280
  /** Grafana users information. */
273
281
  grafanaUsers: GrafanaUser[];
274
282
  }
283
+ /** Response returned when listing data sources. */
284
+ export interface ListManagedAlertsResponse {
285
+ /** Total count of data sources matching the request. */
286
+ totalCount: number;
287
+ /** Alerts matching the request within the pagination. */
288
+ alerts: Alert[];
289
+ }
275
290
  /** Output returned when listing pricing plans. */
276
291
  export interface ListPlansResponse {
277
292
  /** Total count of available pricing plans. */
@@ -488,6 +503,25 @@ export type RegionalApiListDataSourcesRequest = {
488
503
  */
489
504
  types?: DataSourceType[];
490
505
  };
506
+ /** Enable the sending of managed alerts. */
507
+ export type RegionalApiListManagedAlertsRequest = {
508
+ /**
509
+ * Region to target. If none is passed will use default region from the
510
+ * config.
511
+ */
512
+ region?: Region;
513
+ /** Page number to return, from the paginated results. */
514
+ page?: number;
515
+ /** Number of data sources to return per page. */
516
+ pageSize?: number;
517
+ /** Sort order for data sources in the response. */
518
+ orderBy?: ListManagedAlertsRequestOrderBy;
519
+ /**
520
+ * Project ID to filter for, only data sources from this Project will be
521
+ * returned.
522
+ */
523
+ projectId?: string;
524
+ };
491
525
  /** List tokens. */
492
526
  export type RegionalApiListTokensRequest = {
493
527
  /**
@@ -32,6 +32,15 @@ const RegionalApiListDataSourcesRequest = {
32
32
  lessThanOrEqual: 1e3
33
33
  }
34
34
  };
35
+ const RegionalApiListManagedAlertsRequest = {
36
+ page: {
37
+ greaterThanOrEqual: 1
38
+ },
39
+ pageSize: {
40
+ greaterThanOrEqual: 1,
41
+ lessThanOrEqual: 1e3
42
+ }
43
+ };
35
44
  const RegionalApiListTokensRequest = {
36
45
  page: {
37
46
  greaterThanOrEqual: 1
@@ -45,4 +54,5 @@ exports.RegionalApiCreateDataSourceRequest = RegionalApiCreateDataSourceRequest;
45
54
  exports.RegionalApiCreateTokenRequest = RegionalApiCreateTokenRequest;
46
55
  exports.RegionalApiListContactPointsRequest = RegionalApiListContactPointsRequest;
47
56
  exports.RegionalApiListDataSourcesRequest = RegionalApiListDataSourcesRequest;
57
+ exports.RegionalApiListManagedAlertsRequest = RegionalApiListManagedAlertsRequest;
48
58
  exports.RegionalApiListTokensRequest = RegionalApiListTokensRequest;
@@ -30,6 +30,15 @@ export declare const RegionalApiListDataSourcesRequest: {
30
30
  lessThanOrEqual: number;
31
31
  };
32
32
  };
33
+ export declare const RegionalApiListManagedAlertsRequest: {
34
+ page: {
35
+ greaterThanOrEqual: number;
36
+ };
37
+ pageSize: {
38
+ greaterThanOrEqual: number;
39
+ lessThanOrEqual: number;
40
+ };
41
+ };
33
42
  export declare const RegionalApiListTokensRequest: {
34
43
  page: {
35
44
  greaterThanOrEqual: number;
@@ -30,6 +30,15 @@ const RegionalApiListDataSourcesRequest = {
30
30
  lessThanOrEqual: 1e3
31
31
  }
32
32
  };
33
+ const RegionalApiListManagedAlertsRequest = {
34
+ page: {
35
+ greaterThanOrEqual: 1
36
+ },
37
+ pageSize: {
38
+ greaterThanOrEqual: 1,
39
+ lessThanOrEqual: 1e3
40
+ }
41
+ };
33
42
  const RegionalApiListTokensRequest = {
34
43
  page: {
35
44
  greaterThanOrEqual: 1
@@ -44,5 +53,6 @@ export {
44
53
  RegionalApiCreateTokenRequest,
45
54
  RegionalApiListContactPointsRequest,
46
55
  RegionalApiListDataSourcesRequest,
56
+ RegionalApiListManagedAlertsRequest,
47
57
  RegionalApiListTokensRequest
48
58
  };
@@ -3,7 +3,7 @@ export type CronStatus = 'unknown' | 'ready' | 'deleting' | 'error' | 'locked' |
3
3
  export type DomainStatus = 'unknown' | 'ready' | 'deleting' | 'error' | 'creating' | 'pending';
4
4
  export type FunctionHttpOption = 'unknown_http_option' | 'enabled' | 'redirected';
5
5
  export type FunctionPrivacy = 'unknown_privacy' | 'public' | 'private';
6
- export type FunctionRuntime = 'unknown_runtime' | 'golang' | 'python' | 'python3' | 'node8' | 'node10' | 'node14' | 'node16' | 'node17' | 'python37' | 'python38' | 'python39' | 'python310' | 'go113' | 'go117' | 'go118' | 'node18' | 'rust165' | 'go119' | 'python311' | 'php82' | 'node19' | 'go120' | 'node20' | 'go121' | 'node22' | 'python312' | 'php83' | 'go122' | 'rust178';
6
+ export type FunctionRuntime = 'unknown_runtime' | 'golang' | 'python' | 'python3' | 'node8' | 'node10' | 'node14' | 'node16' | 'node17' | 'python37' | 'python38' | 'python39' | 'python310' | 'go113' | 'go117' | 'go118' | 'node18' | 'rust165' | 'go119' | 'python311' | 'php82' | 'node19' | 'go120' | 'node20' | 'go121' | 'node22' | 'python312' | 'php83' | 'go122' | 'rust179';
7
7
  export type FunctionStatus = 'unknown' | 'ready' | 'deleting' | 'error' | 'locked' | 'creating' | 'pending' | 'created';
8
8
  export type ListCronsRequestOrderBy = 'created_at_asc' | 'created_at_desc';
9
9
  export type ListDomainsRequestOrderBy = 'created_at_asc' | 'created_at_desc' | 'hostname_asc' | 'hostname_desc';
@@ -5,8 +5,7 @@ const marshalling = require("../../../helpers/marshalling.cjs");
5
5
  const api_gen = require("./api.gen.cjs");
6
6
  const content_gen = require("./content.gen.cjs");
7
7
  const validateNotUndefined = (obj) => {
8
- if (obj === void 0)
9
- throw new TypeError(`object was found undefined`);
8
+ if (obj === void 0) throw new TypeError(`object was found undefined`);
10
9
  return obj;
11
10
  };
12
11
  class InstanceV1UtilsAPI extends api_gen.API {
@@ -3,8 +3,7 @@ import { validatePathParam } from "../../../helpers/marshalling.js";
3
3
  import { API } from "./api.gen.js";
4
4
  import { IMAGE_TRANSIENT_STATUSES, PRIVATE_NIC_TRANSIENT_STATUSES, SERVER_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES } from "./content.gen.js";
5
5
  const validateNotUndefined = (obj) => {
6
- if (obj === void 0)
7
- throw new TypeError(`object was found undefined`);
6
+ if (obj === void 0) throw new TypeError(`object was found undefined`);
8
7
  return obj;
9
8
  };
10
9
  class InstanceV1UtilsAPI extends API {
@@ -299,7 +299,7 @@ const marshalCreateEmailRequest = (request, defaults) => ({
299
299
  ) : void 0,
300
300
  bcc: request.bcc !== void 0 ? request.bcc.map((elt) => marshalCreateEmailRequestAddress(elt)) : void 0,
301
301
  cc: request.cc !== void 0 ? request.cc.map((elt) => marshalCreateEmailRequestAddress(elt)) : void 0,
302
- from: request.from !== void 0 ? marshalCreateEmailRequestAddress(request.from) : void 0,
302
+ from: marshalCreateEmailRequestAddress(request.from),
303
303
  html: request.html,
304
304
  project_id: request.projectId ?? defaults.defaultProjectId,
305
305
  send_before: request.sendBefore,
@@ -297,7 +297,7 @@ const marshalCreateEmailRequest = (request, defaults) => ({
297
297
  ) : void 0,
298
298
  bcc: request.bcc !== void 0 ? request.bcc.map((elt) => marshalCreateEmailRequestAddress(elt)) : void 0,
299
299
  cc: request.cc !== void 0 ? request.cc.map((elt) => marshalCreateEmailRequestAddress(elt)) : void 0,
300
- from: request.from !== void 0 ? marshalCreateEmailRequestAddress(request.from) : void 0,
300
+ from: marshalCreateEmailRequestAddress(request.from),
301
301
  html: request.html,
302
302
  project_id: request.projectId ?? defaults.defaultProjectId,
303
303
  send_before: request.sendBefore,
@@ -259,7 +259,7 @@ export type CreateEmailRequest = {
259
259
  */
260
260
  region?: Region;
261
261
  /** Sender information. Must be from a checked domain declared in the Project. */
262
- from?: CreateEmailRequestAddress;
262
+ from: CreateEmailRequestAddress;
263
263
  /** An array of the primary recipient's information. */
264
264
  to?: CreateEmailRequestAddress[];
265
265
  /** An array of the carbon copy recipient's information. */
@@ -1,5 +1,62 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const CreateDomainRequest = {
4
+ domainName: {
5
+ maxLength: 255,
6
+ minLength: 1
7
+ }
8
+ };
9
+ const CreateEmailRequest = {
10
+ subject: {
11
+ minLength: 6
12
+ }
13
+ };
14
+ const CreateEmailRequestAddress = {
15
+ email: {
16
+ minLength: 1
17
+ }
18
+ };
19
+ const CreateEmailRequestAttachment = {
20
+ name: {
21
+ minLength: 1
22
+ },
23
+ type: {
24
+ minLength: 1
25
+ }
26
+ };
27
+ const CreateEmailRequestHeader = {
28
+ key: {
29
+ minLength: 1
30
+ },
31
+ value: {
32
+ minLength: 1
33
+ }
34
+ };
35
+ const ListDomainsRequest = {
36
+ page: {
37
+ greaterThan: 0
38
+ },
39
+ pageSize: {
40
+ greaterThanOrEqual: 1,
41
+ lessThanOrEqual: 1e3
42
+ }
43
+ };
44
+ const ListEmailsRequest = {
45
+ page: {
46
+ greaterThan: 0
47
+ },
48
+ pageSize: {
49
+ greaterThanOrEqual: 1,
50
+ lessThanOrEqual: 1e3
51
+ },
52
+ search: {
53
+ maxLength: 100,
54
+ minLength: 3
55
+ },
56
+ subject: {
57
+ minLength: 6
58
+ }
59
+ };
3
60
  const ListWebhookEventsRequest = {
4
61
  page: {
5
62
  greaterThan: 0
@@ -28,6 +85,13 @@ const UpdateWebhookRequest = {
28
85
  minLength: 3
29
86
  }
30
87
  };
88
+ exports.CreateDomainRequest = CreateDomainRequest;
89
+ exports.CreateEmailRequest = CreateEmailRequest;
90
+ exports.CreateEmailRequestAddress = CreateEmailRequestAddress;
91
+ exports.CreateEmailRequestAttachment = CreateEmailRequestAttachment;
92
+ exports.CreateEmailRequestHeader = CreateEmailRequestHeader;
93
+ exports.ListDomainsRequest = ListDomainsRequest;
94
+ exports.ListEmailsRequest = ListEmailsRequest;
31
95
  exports.ListWebhookEventsRequest = ListWebhookEventsRequest;
32
96
  exports.ListWebhooksRequest = ListWebhooksRequest;
33
97
  exports.UpdateWebhookRequest = UpdateWebhookRequest;
@@ -1,3 +1,60 @@
1
+ export declare const CreateDomainRequest: {
2
+ domainName: {
3
+ maxLength: number;
4
+ minLength: number;
5
+ };
6
+ };
7
+ export declare const CreateEmailRequest: {
8
+ subject: {
9
+ minLength: number;
10
+ };
11
+ };
12
+ export declare const CreateEmailRequestAddress: {
13
+ email: {
14
+ minLength: number;
15
+ };
16
+ };
17
+ export declare const CreateEmailRequestAttachment: {
18
+ name: {
19
+ minLength: number;
20
+ };
21
+ type: {
22
+ minLength: number;
23
+ };
24
+ };
25
+ export declare const CreateEmailRequestHeader: {
26
+ key: {
27
+ minLength: number;
28
+ };
29
+ value: {
30
+ minLength: number;
31
+ };
32
+ };
33
+ export declare const ListDomainsRequest: {
34
+ page: {
35
+ greaterThan: number;
36
+ };
37
+ pageSize: {
38
+ greaterThanOrEqual: number;
39
+ lessThanOrEqual: number;
40
+ };
41
+ };
42
+ export declare const ListEmailsRequest: {
43
+ page: {
44
+ greaterThan: number;
45
+ };
46
+ pageSize: {
47
+ greaterThanOrEqual: number;
48
+ lessThanOrEqual: number;
49
+ };
50
+ search: {
51
+ maxLength: number;
52
+ minLength: number;
53
+ };
54
+ subject: {
55
+ minLength: number;
56
+ };
57
+ };
1
58
  export declare const ListWebhookEventsRequest: {
2
59
  page: {
3
60
  greaterThan: number;
@@ -1,3 +1,60 @@
1
+ const CreateDomainRequest = {
2
+ domainName: {
3
+ maxLength: 255,
4
+ minLength: 1
5
+ }
6
+ };
7
+ const CreateEmailRequest = {
8
+ subject: {
9
+ minLength: 6
10
+ }
11
+ };
12
+ const CreateEmailRequestAddress = {
13
+ email: {
14
+ minLength: 1
15
+ }
16
+ };
17
+ const CreateEmailRequestAttachment = {
18
+ name: {
19
+ minLength: 1
20
+ },
21
+ type: {
22
+ minLength: 1
23
+ }
24
+ };
25
+ const CreateEmailRequestHeader = {
26
+ key: {
27
+ minLength: 1
28
+ },
29
+ value: {
30
+ minLength: 1
31
+ }
32
+ };
33
+ const ListDomainsRequest = {
34
+ page: {
35
+ greaterThan: 0
36
+ },
37
+ pageSize: {
38
+ greaterThanOrEqual: 1,
39
+ lessThanOrEqual: 1e3
40
+ }
41
+ };
42
+ const ListEmailsRequest = {
43
+ page: {
44
+ greaterThan: 0
45
+ },
46
+ pageSize: {
47
+ greaterThanOrEqual: 1,
48
+ lessThanOrEqual: 1e3
49
+ },
50
+ search: {
51
+ maxLength: 100,
52
+ minLength: 3
53
+ },
54
+ subject: {
55
+ minLength: 6
56
+ }
57
+ };
1
58
  const ListWebhookEventsRequest = {
2
59
  page: {
3
60
  greaterThan: 0
@@ -27,6 +84,13 @@ const UpdateWebhookRequest = {
27
84
  }
28
85
  };
29
86
  export {
87
+ CreateDomainRequest,
88
+ CreateEmailRequest,
89
+ CreateEmailRequestAddress,
90
+ CreateEmailRequestAttachment,
91
+ CreateEmailRequestHeader,
92
+ ListDomainsRequest,
93
+ ListEmailsRequest,
30
94
  ListWebhookEventsRequest,
31
95
  ListWebhooksRequest,
32
96
  UpdateWebhookRequest
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  function validatePathParam(name, param) {
4
- if (typeof param === "string" && param.length > 0)
5
- return param;
6
- if (typeof param === "number")
7
- return param.toString();
4
+ if (typeof param === "string" && param.length > 0) return param;
5
+ if (typeof param === "number") return param.toString();
8
6
  throw new TypeError(`param ${name} cannot be empty in request`);
9
7
  }
10
8
  const resolveOneOf = (list, isRequired = false) => {
@@ -1,8 +1,6 @@
1
1
  function validatePathParam(name, param) {
2
- if (typeof param === "string" && param.length > 0)
3
- return param;
4
- if (typeof param === "number")
5
- return param.toString();
2
+ if (typeof param === "string" && param.length > 0) return param;
3
+ if (typeof param === "number") return param.toString();
6
4
  throw new TypeError(`param ${name} cannot be empty in request`);
7
5
  }
8
6
  const resolveOneOf = (list, isRequired = false) => {
@@ -27,12 +27,10 @@ const tryAtIntervals = async (retry, strategy, timeout = DEFAULT_TIMEOUT_SECONDS
27
27
  let retryCount = 0;
28
28
  while (Date.now() <= timeoutTimestamp) {
29
29
  const delay = strategy.next(retryCount += 1).value * 1e3;
30
- if (timeoutTimestamp <= Date.now() + delay)
31
- break;
30
+ if (timeoutTimestamp <= Date.now() + delay) break;
32
31
  await sleep.sleep(delay);
33
32
  const { value, done } = await retry();
34
- if (done)
35
- return value;
33
+ if (done) return value;
36
34
  }
37
35
  throw new Error(`Timeout after ${timeout}s`);
38
36
  };
@@ -25,12 +25,10 @@ const tryAtIntervals = async (retry, strategy, timeout = DEFAULT_TIMEOUT_SECONDS
25
25
  let retryCount = 0;
26
26
  while (Date.now() <= timeoutTimestamp) {
27
27
  const delay = strategy.next(retryCount += 1).value * 1e3;
28
- if (timeoutTimestamp <= Date.now() + delay)
29
- break;
28
+ if (timeoutTimestamp <= Date.now() + delay) break;
30
29
  await sleep(delay);
31
30
  const { value, done } = await retry();
32
- if (done)
33
- return value;
31
+ if (done) return value;
34
32
  }
35
33
  throw new Error(`Timeout after ${timeout}s`);
36
34
  };
package/dist/scw/auth.cjs CHANGED
@@ -15,10 +15,8 @@ const obfuscateAuthHeadersEntry = ([
15
15
  name,
16
16
  value
17
17
  ]) => {
18
- if (name === SESSION_HEADER_KEY)
19
- return [name, obfuscateToken(value)];
20
- if (name === AUTH_HEADER_KEY)
21
- return [name, obfuscateUUID(value)];
18
+ if (name === SESSION_HEADER_KEY) return [name, obfuscateToken(value)];
19
+ if (name === AUTH_HEADER_KEY) return [name, obfuscateUUID(value)];
22
20
  return [name, value];
23
21
  };
24
22
  exports.authenticateWithSecrets = authenticateWithSecrets;
package/dist/scw/auth.js CHANGED
@@ -13,10 +13,8 @@ const obfuscateAuthHeadersEntry = ([
13
13
  name,
14
14
  value
15
15
  ]) => {
16
- if (name === SESSION_HEADER_KEY)
17
- return [name, obfuscateToken(value)];
18
- if (name === AUTH_HEADER_KEY)
19
- return [name, obfuscateUUID(value)];
16
+ if (name === SESSION_HEADER_KEY) return [name, obfuscateToken(value)];
17
+ if (name === AUTH_HEADER_KEY) return [name, obfuscateUUID(value)];
20
18
  return [name, value];
21
19
  };
22
20
  export {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const version = "v2.33.0";
3
+ const version = "v2.34.0";
4
4
  const userAgent = `scaleway-sdk-js/${version}`;
5
5
  exports.userAgent = userAgent;
6
6
  exports.version = version;
@@ -1,2 +1,2 @@
1
- export declare const version = "v2.33.0";
2
- export declare const userAgent = "scaleway-sdk-js/v2.33.0";
1
+ export declare const version = "v2.34.0";
2
+ export declare const userAgent = "scaleway-sdk-js/v2.34.0";
@@ -1,4 +1,4 @@
1
- const version = "v2.33.0";
1
+ const version = "v2.34.0";
2
2
  const userAgent = `scaleway-sdk-js/${version}`;
3
3
  export {
4
4
  userAgent,
@@ -36,8 +36,7 @@ class InvalidArgumentsError extends scwError.ScalewayError {
36
36
  this.name = "InvalidArgumentsError";
37
37
  }
38
38
  static fromJSON(status, obj) {
39
- if (!Array.isArray(obj.details))
40
- return null;
39
+ if (!Array.isArray(obj.details)) return null;
41
40
  return new InvalidArgumentsError(
42
41
  status,
43
42
  obj,
@@ -34,8 +34,7 @@ class InvalidArgumentsError extends ScalewayError {
34
34
  this.name = "InvalidArgumentsError";
35
35
  }
36
36
  static fromJSON(status, obj) {
37
- if (!Array.isArray(obj.details))
38
- return null;
37
+ if (!Array.isArray(obj.details)) return null;
39
38
  return new InvalidArgumentsError(
40
39
  status,
41
40
  obj,
@@ -10,8 +10,7 @@ class OutOfStockError extends scwError.ScalewayError {
10
10
  this.name = "OutOfStockError";
11
11
  }
12
12
  static fromJSON(status, obj) {
13
- if (typeof obj.resource !== "string")
14
- return null;
13
+ if (typeof obj.resource !== "string") return null;
15
14
  return new OutOfStockError(status, obj, obj.resource);
16
15
  }
17
16
  }
@@ -8,8 +8,7 @@ class OutOfStockError extends ScalewayError {
8
8
  this.name = "OutOfStockError";
9
9
  }
10
10
  static fromJSON(status, obj) {
11
- if (typeof obj.resource !== "string")
12
- return null;
11
+ if (typeof obj.resource !== "string") return null;
13
12
  return new OutOfStockError(status, obj, obj.resource);
14
13
  }
15
14
  }
@@ -12,8 +12,7 @@ class PermissionsDeniedError extends scwError.ScalewayError {
12
12
  this.name = "PermissionsDeniedError";
13
13
  }
14
14
  static fromJSON(status, obj) {
15
- if (!Array.isArray(obj.details))
16
- return null;
15
+ if (!Array.isArray(obj.details)) return null;
17
16
  return new PermissionsDeniedError(
18
17
  status,
19
18
  obj,
@@ -10,8 +10,7 @@ class PermissionsDeniedError extends ScalewayError {
10
10
  this.name = "PermissionsDeniedError";
11
11
  }
12
12
  static fromJSON(status, obj) {
13
- if (!Array.isArray(obj.details))
14
- return null;
13
+ if (!Array.isArray(obj.details)) return null;
15
14
  return new PermissionsDeniedError(
16
15
  status,
17
16
  obj,
@@ -24,8 +24,7 @@ class QuotasExceededError extends scwError.ScalewayError {
24
24
  this.name = "QuotasExceededError";
25
25
  }
26
26
  static fromJSON(status, obj) {
27
- if (!Array.isArray(obj.details))
28
- return null;
27
+ if (!Array.isArray(obj.details)) return null;
29
28
  return new QuotasExceededError(
30
29
  status,
31
30
  obj,
@@ -22,8 +22,7 @@ class QuotasExceededError extends ScalewayError {
22
22
  this.name = "QuotasExceededError";
23
23
  }
24
24
  static fromJSON(status, obj) {
25
- if (!Array.isArray(obj.details))
26
- return null;
25
+ if (!Array.isArray(obj.details)) return null;
27
26
  return new QuotasExceededError(
28
27
  status,
29
28
  obj,
@@ -37,8 +37,7 @@ class TooManyRequestsError extends scwError.ScalewayError {
37
37
  this.name = "TooManyRequestsError";
38
38
  }
39
39
  static fromJSON(status, obj) {
40
- if (typeof obj.help_message !== "string")
41
- return null;
40
+ if (typeof obj.help_message !== "string") return null;
42
41
  let limit;
43
42
  if (json.isJSONObject(obj.limit) && typeof obj.limit.quota === "number") {
44
43
  limit = {
@@ -35,8 +35,7 @@ class TooManyRequestsError extends ScalewayError {
35
35
  this.name = "TooManyRequestsError";
36
36
  }
37
37
  static fromJSON(status, obj) {
38
- if (typeof obj.help_message !== "string")
39
- return null;
38
+ if (typeof obj.help_message !== "string") return null;
40
39
  let limit;
41
40
  if (isJSONObject(obj.limit) && typeof obj.limit.quota === "number") {
42
41
  limit = {
@@ -12,8 +12,7 @@ function* pages(key, fetcher, request, firstPage) {
12
12
  page += 1;
13
13
  }
14
14
  const { length } = firstPage[key];
15
- if (!length)
16
- return;
15
+ if (!length) return;
17
16
  const { totalCount } = firstPage;
18
17
  while (page <= Math.floor((totalCount + length - 1) / length)) {
19
18
  yield fetcher({ ...request, page }).then(getList);
@@ -10,8 +10,7 @@ function* pages(key, fetcher, request, firstPage) {
10
10
  page += 1;
11
11
  }
12
12
  const { length } = firstPage[key];
13
- if (!length)
14
- return;
13
+ if (!length) return;
15
14
  const { totalCount } = firstPage;
16
15
  while (page <= Math.floor((totalCount + length - 1) / length)) {
17
16
  yield fetcher({ ...request, page }).then(getList);
@@ -25,8 +25,7 @@ const responseParser = (unmarshaller, responseType) => async (response) => {
25
25
  throw new TypeError("Invalid response object");
26
26
  }
27
27
  if (response.ok) {
28
- if (response.status === 204)
29
- return unmarshaller(void 0);
28
+ if (response.status === 204) return unmarshaller(void 0);
30
29
  const contentType = response.headers.get("Content-Type");
31
30
  try {
32
31
  if (responseType === "json" && contentType === "application/json") {
@@ -46,8 +45,7 @@ const responseParser = (unmarshaller, responseType) => async (response) => {
46
45
  }
47
46
  }
48
47
  const error = await response.clone().json().catch(() => response.text());
49
- if (json.isJSONObject(error))
50
- throw errorParser.parseScalewayError(response.status, error);
48
+ if (json.isJSONObject(error)) throw errorParser.parseScalewayError(response.status, error);
51
49
  throw new scwError.ScalewayError(
52
50
  response.status,
53
51
  typeof error === "string" ? error : "cannot read error response body"
@@ -23,8 +23,7 @@ const responseParser = (unmarshaller, responseType) => async (response) => {
23
23
  throw new TypeError("Invalid response object");
24
24
  }
25
25
  if (response.ok) {
26
- if (response.status === 204)
27
- return unmarshaller(void 0);
26
+ if (response.status === 204) return unmarshaller(void 0);
28
27
  const contentType = response.headers.get("Content-Type");
29
28
  try {
30
29
  if (responseType === "json" && contentType === "application/json") {
@@ -44,8 +43,7 @@ const responseParser = (unmarshaller, responseType) => async (response) => {
44
43
  }
45
44
  }
46
45
  const error = await response.clone().json().catch(() => response.text());
47
- if (isJSONObject(error))
48
- throw parseScalewayError(response.status, error);
46
+ if (isJSONObject(error)) throw parseScalewayError(response.status, error);
49
47
  throw new ScalewayError(
50
48
  response.status,
51
49
  typeof error === "string" ? error : "cannot read error response body"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk",
3
- "version": "2.34.0",
3
+ "version": "2.35.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Scaleway SDK.",
6
6
  "keywords": [
@@ -39,5 +39,5 @@
39
39
  "bundledDependencies": [
40
40
  "@scaleway/random-name"
41
41
  ],
42
- "gitHead": "57a03a394a78af1d6f2945cefda2655a03a17ae9"
42
+ "gitHead": "5577d926122ccbc5b25a5c6f54285abd0fb6e9a5"
43
43
  }