From e6325d33885ba335366da0ff19a2c06ea620122d Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Tue, 15 Oct 2024 14:45:48 +0000 Subject: [PATCH] feat: update generated APIs --- .../src/api/edge_services/v1alpha1/api.gen.ts | 40 +++++++++++- .../api/edge_services/v1alpha1/index.gen.ts | 4 ++ .../edge_services/v1alpha1/marshalling.gen.ts | 36 +++++++++++ .../api/edge_services/v1alpha1/types.gen.ts | 62 ++++++++++++++++--- 4 files changed, 131 insertions(+), 11 deletions(-) diff --git a/packages/clients/src/api/edge_services/v1alpha1/api.gen.ts b/packages/clients/src/api/edge_services/v1alpha1/api.gen.ts index d07adf9f4..485d77b46 100644 --- a/packages/clients/src/api/edge_services/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/edge_services/v1alpha1/api.gen.ts @@ -39,6 +39,7 @@ import { unmarshalListCacheStagesResponse, unmarshalListDNSStagesResponse, unmarshalListPipelinesResponse, + unmarshalListPipelinesWithStagesResponse, unmarshalListPlansResponse, unmarshalListPurgeRequestsResponse, unmarshalListTLSStagesResponse, @@ -86,6 +87,8 @@ import type { ListDNSStagesResponse, ListPipelinesRequest, ListPipelinesResponse, + ListPipelinesWithStagesRequest, + ListPipelinesWithStagesResponse, ListPlansResponse, ListPurgeRequestsRequest, ListPurgeRequestsResponse, @@ -202,6 +205,37 @@ export class API extends ParentAPI { options, ) + protected pageOfListPipelinesWithStages = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/edge-services/v1alpha1/pipelines-stages`, + urlParams: urlParams( + ['name', request.name], + ['order_by', request.orderBy], + ['organization_id', request.organizationId], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListPipelinesWithStagesResponse, + ) + + listPipelinesWithStages = ( + request: Readonly = {}, + ) => + enrichForPagination( + 'pipelines', + this.pageOfListPipelinesWithStages, + request, + ) + /** * Update pipeline. Update the parameters of an existing pipeline, specified * by its `pipeline_id`. Parameters which can be updated include the `name`, @@ -831,8 +865,10 @@ export class API extends ParentAPI { }) /** - * Gives information on current edge-services subscription plan and used - * resources with associated price. + * Gives information on the currently selected Edge Services subscription + * plan, resource usage and associated billing information for this calendar + * month (including whether consumption falls within or exceeds the currently + * selected subscription plan.). * * @param request - The request {@link GetBillingRequest} * @returns A Promise of GetBillingResponse diff --git a/packages/clients/src/api/edge_services/v1alpha1/index.gen.ts b/packages/clients/src/api/edge_services/v1alpha1/index.gen.ts index 3a5f14d98..13bc235ce 100644 --- a/packages/clients/src/api/edge_services/v1alpha1/index.gen.ts +++ b/packages/clients/src/api/edge_services/v1alpha1/index.gen.ts @@ -48,6 +48,9 @@ export type { ListPipelinesRequest, ListPipelinesRequestOrderBy, ListPipelinesResponse, + ListPipelinesWithStagesRequest, + ListPipelinesWithStagesRequestOrderBy, + ListPipelinesWithStagesResponse, ListPlansResponse, ListPurgeRequestsRequest, ListPurgeRequestsRequestOrderBy, @@ -61,6 +64,7 @@ export type { PipelineErrorSeverity, PipelineErrorStage, PipelineErrorType, + PipelineStages, PipelineStatus, Plan, PlanDetails, diff --git a/packages/clients/src/api/edge_services/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/edge_services/v1alpha1/marshalling.gen.ts index 0474fd538..5edac9ec4 100644 --- a/packages/clients/src/api/edge_services/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/edge_services/v1alpha1/marshalling.gen.ts @@ -30,11 +30,13 @@ import type { ListCacheStagesResponse, ListDNSStagesResponse, ListPipelinesResponse, + ListPipelinesWithStagesResponse, ListPlansResponse, ListPurgeRequestsResponse, ListTLSStagesResponse, Pipeline, PipelineError, + PipelineStages, Plan, PlanDetails, PurgeRequest, @@ -229,6 +231,25 @@ export const unmarshalTLSStage = (data: unknown): TLSStage => { } as TLSStage } +export const unmarshalPipelineStages = (data: unknown): PipelineStages => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'PipelineStages' failed as data isn't a dictionary.`, + ) + } + + return { + backendStages: unmarshalArrayOfObject( + data.backend_stages, + unmarshalBackendStage, + ), + cacheStages: unmarshalArrayOfObject(data.cache_stages, unmarshalCacheStage), + dnsStages: unmarshalArrayOfObject(data.dns_stages, unmarshalDNSStage), + pipeline: data.pipeline ? unmarshalPipeline(data.pipeline) : undefined, + tlsStages: unmarshalArrayOfObject(data.tls_stages, unmarshalTLSStage), + } as PipelineStages +} + export const unmarshalPurgeRequest = (data: unknown): PurgeRequest => { if (!isJSONObject(data)) { throw new TypeError( @@ -391,6 +412,21 @@ export const unmarshalListPipelinesResponse = ( } as ListPipelinesResponse } +export const unmarshalListPipelinesWithStagesResponse = ( + data: unknown, +): ListPipelinesWithStagesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListPipelinesWithStagesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + pipelines: unmarshalArrayOfObject(data.pipelines, unmarshalPipelineStages), + totalCount: data.total_count, + } as ListPipelinesWithStagesResponse +} + export const unmarshalListPlansResponse = ( data: unknown, ): ListPlansResponse => { diff --git a/packages/clients/src/api/edge_services/v1alpha1/types.gen.ts b/packages/clients/src/api/edge_services/v1alpha1/types.gen.ts index 455974838..27336fd1f 100644 --- a/packages/clients/src/api/edge_services/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/edge_services/v1alpha1/types.gen.ts @@ -24,6 +24,12 @@ export type ListPipelinesRequestOrderBy = | 'name_asc' | 'name_desc' +export type ListPipelinesWithStagesRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'name_asc' + | 'name_desc' + export type ListPurgeRequestsRequestOrderBy = | 'created_at_asc' | 'created_at_desc' @@ -283,10 +289,18 @@ export interface PlanDetails { planName: PlanName /** Amount of egress data from cache included in subscription plan. */ packageGb: number - /** Number of pipeline included in subscription plan. */ + /** Number of pipelines included in subscription plan. */ pipelineLimit: number } +export interface PipelineStages { + pipeline?: Pipeline + dnsStages: DNSStage[] + tlsStages: TLSStage[] + cacheStages: CacheStage[] + backendStages: BackendStage[] +} + export interface PurgeRequest { /** ID of the purge request. */ id: string @@ -509,23 +523,39 @@ export type GetBillingRequest = { } export interface GetBillingResponse { - /** Information on the current edge-service subscription plan. */ + /** + * Information on the currently-selected, active Edge Services subscription + * plan. + */ currentPlan?: PlanDetails /** Price of the current subscription plan. */ planCost?: Money - /** Total number of pipeline currently configured. */ + /** Total number of pipelines currently configured. */ pipelineNumber: number - /** Cost to date of the pipelines not included in the plans. */ + /** + * Cost to date (this month) of pipelines not included in the subscription + * plan. + */ extraPipelinesCost?: Money - /** Total amount of data egressed from cache in current subscription plan. */ + /** + * Total amount of data egressed from the cache (this month), included in the + * active subscription plan. + */ currentPlanCacheUsage: number - /** Total amount of data egressed from cache not included in the plans. */ + /** + * Total amount of data egressed from cache (this month), not included in the + * active subscription plan. + */ extraCacheUsage: number - /** Cost to date of the data egressed from cache not included in the plans. */ + /** + * Cost to date (this month) of the data egressed from the cache that is not + * included in the active subscription plan. + */ extraCacheCost?: Money /** - * Total cost to date of edge-service product for the month including current - * plan, previous plans, extra pipelines and extra egress cache data. + * Total cost to date (this month) of all Edge Services resources including + * active subscription plan, previously active plans, extra pipelines and + * extra egress cache data. */ totalCost?: Money } @@ -693,6 +723,20 @@ export interface ListPipelinesResponse { totalCount: number } +export type ListPipelinesWithStagesRequest = { + orderBy?: ListPipelinesWithStagesRequestOrderBy + page?: number + pageSize?: number + name?: string + organizationId?: string + projectId?: string +} + +export interface ListPipelinesWithStagesResponse { + pipelines: PipelineStages[] + totalCount: number +} + export interface ListPlansResponse { totalCount: number plans: PlanDetails[]