From 897bb13cdcedf18ea1f2900c9a4a4ef667f2d73e Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Fri, 14 Nov 2025 09:00:48 +0000 Subject: [PATCH] feat: update generated APIs --- packages_generated/cockpit/src/v1/api.gen.ts | 31 ++++++++++++++ .../cockpit/src/v1/index.gen.ts | 4 ++ .../cockpit/src/v1/marshalling.gen.ts | 32 ++++++++++++++ .../cockpit/src/v1/types.gen.ts | 42 +++++++++++++++++++ .../cockpit/src/v1/validation-rules.gen.ts | 11 +++++ 5 files changed, 120 insertions(+) diff --git a/packages_generated/cockpit/src/v1/api.gen.ts b/packages_generated/cockpit/src/v1/api.gen.ts index d5c8f88ed..83c138e62 100644 --- a/packages_generated/cockpit/src/v1/api.gen.ts +++ b/packages_generated/cockpit/src/v1/api.gen.ts @@ -40,6 +40,7 @@ import { unmarshalListGrafanaProductDashboardsResponse, unmarshalListGrafanaUsersResponse, unmarshalListPlansResponse, + unmarshalListProductsResponse, unmarshalListTokensResponse, unmarshalPlan, unmarshalToken, @@ -73,6 +74,7 @@ import type { ListGrafanaProductDashboardsResponse, ListGrafanaUsersResponse, ListPlansResponse, + ListProductsResponse, ListTokensResponse, Plan, RegionalApiCreateContactPointRequest, @@ -94,6 +96,7 @@ import type { RegionalApiListAlertsRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, + RegionalApiListProductsRequest, RegionalApiListTokensRequest, RegionalApiTriggerTestAlertRequest, RegionalApiUpdateContactPointRequest, @@ -627,6 +630,34 @@ You can filter tokens by Project ID and token scopes. path: `/cockpit/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/tokens/${validatePathParam('tokenId', request.tokenId)}`, }) + protected pageOfListProducts = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/cockpit/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/products`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ), + }, + unmarshalListProductsResponse, + ) + + /** + * List all Scaleway products that send metrics and/or logs to Cockpit.. List all Scaleway products that send metrics and/or logs to Cockpit. + * + * @param request - The request {@link RegionalApiListProductsRequest} + * @returns A Promise of ListProductsResponse + */ + listProducts = (request: Readonly = {}) => + enrichForPagination('productsList', this.pageOfListProducts, request) + /** * Get the Alert manager. Retrieve information about the Alert manager which is unique per Project and region. By default the Alert manager is disabled. The output returned displays a URL to access the Alert manager, and whether the Alert manager and managed alerts are enabled. diff --git a/packages_generated/cockpit/src/v1/index.gen.ts b/packages_generated/cockpit/src/v1/index.gen.ts index c6324d011..5c4c354af 100644 --- a/packages_generated/cockpit/src/v1/index.gen.ts +++ b/packages_generated/cockpit/src/v1/index.gen.ts @@ -44,11 +44,14 @@ export type { ListGrafanaUsersResponse, ListPlansRequestOrderBy, ListPlansResponse, + ListProductsRequestOrderBy, + ListProductsResponse, ListTokensRequestOrderBy, ListTokensResponse, Plan, PlanName, PreconfiguredAlertData, + Product, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, @@ -68,6 +71,7 @@ export type { RegionalApiListAlertsRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, + RegionalApiListProductsRequest, RegionalApiListTokensRequest, RegionalApiTriggerTestAlertRequest, RegionalApiUpdateContactPointRequest, diff --git a/packages_generated/cockpit/src/v1/marshalling.gen.ts b/packages_generated/cockpit/src/v1/marshalling.gen.ts index db16524df..20403226c 100644 --- a/packages_generated/cockpit/src/v1/marshalling.gen.ts +++ b/packages_generated/cockpit/src/v1/marshalling.gen.ts @@ -31,9 +31,11 @@ import type { ListGrafanaProductDashboardsResponse, ListGrafanaUsersResponse, ListPlansResponse, + ListProductsResponse, ListTokensResponse, Plan, PreconfiguredAlertData, + Product, RegionalApiCreateContactPointRequest, RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, @@ -444,6 +446,36 @@ export const unmarshalListPlansResponse = ( } as ListPlansResponse } +const unmarshalProduct = (data: unknown): Product => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Product' failed as data isn't a dictionary.`, + ) + } + + return { + displayName: data.display_name, + familyName: data.family_name, + name: data.name, + resourceTypes: data.resource_types, + } as Product +} + +export const unmarshalListProductsResponse = ( + data: unknown, +): ListProductsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListProductsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + productsList: unmarshalArrayOfObject(data.products_list, unmarshalProduct), + totalCount: data.total_count, + } as ListProductsResponse +} + export const unmarshalListTokensResponse = ( data: unknown, ): ListTokensResponse => { diff --git a/packages_generated/cockpit/src/v1/types.gen.ts b/packages_generated/cockpit/src/v1/types.gen.ts index 4e1f5e4e1..d6ba5bf46 100644 --- a/packages_generated/cockpit/src/v1/types.gen.ts +++ b/packages_generated/cockpit/src/v1/types.gen.ts @@ -33,6 +33,14 @@ export type ListGrafanaUsersRequestOrderBy = 'login_asc' | 'login_desc' export type ListPlansRequestOrderBy = 'name_asc' | 'name_desc' +export type ListProductsRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'display_name_asc' + | 'display_name_desc' + | 'family_name_asc' + | 'family_name_desc' + export type ListTokensRequestOrderBy = | 'created_at_asc' | 'created_at_desc' @@ -308,6 +316,13 @@ export interface Plan { monthlyPrice: number } +export interface Product { + name: string + displayName: string + familyName: string + resourceTypes: string[] +} + /** * Token. */ @@ -732,6 +747,11 @@ export interface ListPlansResponse { plans: Plan[] } +export interface ListProductsResponse { + productsList: Product[] + totalCount: number +} + /** * Response returned when listing tokens. */ @@ -1082,6 +1102,28 @@ export type RegionalApiListDataSourcesRequest = { types?: DataSourceType[] } +/** + * List all Scaleway products that send metrics and/or logs to Cockpit. + */ +export type RegionalApiListProductsRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * Page number to return from the paginated results. + */ + page?: number + /** + * Number of products to return per page. + */ + pageSize?: number + /** + * Sort order for products in the response. + */ + orderBy?: ListProductsRequestOrderBy +} + /** * List tokens. */ diff --git a/packages_generated/cockpit/src/v1/validation-rules.gen.ts b/packages_generated/cockpit/src/v1/validation-rules.gen.ts index 1a6562a47..20379e3b3 100644 --- a/packages_generated/cockpit/src/v1/validation-rules.gen.ts +++ b/packages_generated/cockpit/src/v1/validation-rules.gen.ts @@ -42,6 +42,17 @@ export const RegionalApiListDataSourcesRequest = { }, } +export const RegionalApiListProductsRequest = { + page: { + greaterThanOrEqual: 1, + lessThanOrEqual: 10000, + }, + pageSize: { + greaterThanOrEqual: 1, + lessThanOrEqual: 100, + }, +} + export const RegionalApiListTokensRequest = { page: { greaterThanOrEqual: 1,