From d5e8f0780bd2da60cbf00b267beceac2affb38fa Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Wed, 12 Feb 2025 15:24:04 +0000 Subject: [PATCH] feat: update generated APIs --- .../api/edge_services/v1alpha1/index.gen.ts | 1 + .../edge_services/v1alpha1/marshalling.gen.ts | 25 +++++++++++++ .../api/edge_services/v1alpha1/types.gen.ts | 35 +++++++++++++++++++ 3 files changed, 61 insertions(+) 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 13bc235ce..1d3db498f 100644 --- a/packages/clients/src/api/edge_services/v1alpha1/index.gen.ts +++ b/packages/clients/src/api/edge_services/v1alpha1/index.gen.ts @@ -69,6 +69,7 @@ export type { Plan, PlanDetails, PlanName, + PlanUsageDetails, PurgeRequest, PurgeRequestStatus, ScalewayLb, 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 0d16b23b3..66e2be32a 100644 --- a/packages/clients/src/api/edge_services/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/edge_services/v1alpha1/marshalling.gen.ts @@ -5,6 +5,7 @@ import { resolveOneOf, unmarshalArrayOfObject, unmarshalDate, + unmarshalMapOfObject, unmarshalMoney, } from '../../../bridge' import type { DefaultValues } from '../../../bridge' @@ -39,6 +40,7 @@ import type { PipelineStages, Plan, PlanDetails, + PlanUsageDetails, PurgeRequest, ScalewayLb, ScalewayLbBackendConfig, @@ -323,9 +325,22 @@ const unmarshalPlanDetails = (data: unknown): PlanDetails => { packageGb: data.package_gb, pipelineLimit: data.pipeline_limit, planName: data.plan_name, + wafRequests: data.waf_requests, } as PlanDetails } +const unmarshalPlanUsageDetails = (data: unknown): PlanUsageDetails => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'PlanUsageDetails' failed as data isn't a dictionary.`, + ) + } + + return { + planCost: data.plan_cost ? unmarshalMoney(data.plan_cost) : undefined, + } as PlanUsageDetails +} + export const unmarshalGetBillingResponse = ( data: unknown, ): GetBillingResponse => { @@ -340,6 +355,7 @@ export const unmarshalGetBillingResponse = ( ? unmarshalPlanDetails(data.current_plan) : undefined, currentPlanCacheUsage: data.current_plan_cache_usage, + currentPlanWafUsage: data.current_plan_waf_usage, extraCacheCost: data.extra_cache_cost ? unmarshalMoney(data.extra_cache_cost) : undefined, @@ -347,9 +363,18 @@ export const unmarshalGetBillingResponse = ( extraPipelinesCost: data.extra_pipelines_cost ? unmarshalMoney(data.extra_pipelines_cost) : undefined, + extraWafCost: data.extra_waf_cost + ? unmarshalMoney(data.extra_waf_cost) + : undefined, + extraWafUsage: data.extra_waf_usage, pipelineNumber: data.pipeline_number, planCost: data.plan_cost ? unmarshalMoney(data.plan_cost) : undefined, + plansUsageDetails: unmarshalMapOfObject( + data.plans_usage_details, + unmarshalPlanUsageDetails, + ), totalCost: data.total_cost ? unmarshalMoney(data.total_cost) : undefined, + wafAddOn: data.waf_add_on ? unmarshalMoney(data.waf_add_on) : undefined, } as GetBillingResponse } 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 8ec548349..2e350598c 100644 --- a/packages/clients/src/api/edge_services/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/edge_services/v1alpha1/types.gen.ts @@ -297,6 +297,16 @@ export interface PlanDetails { packageGb: number /** Number of pipelines included in subscription plan. */ pipelineLimit: number + /** Number of WAF requests included in subscription plan. */ + wafRequests: number +} + +export interface PlanUsageDetails { + /** + * Cost to date (this month) for the corresponding Edge Services subscription + * plan. + */ + planCost?: Money } export interface PipelineStages { @@ -562,6 +572,31 @@ export interface GetBillingResponse { * included in the subscription plans. */ extraCacheCost?: Money + /** + * Total number of requests processed by the WAF since the beginning of the + * current month, for the active subscription plan. + */ + currentPlanWafUsage: number + /** + * Total number of extra requests processed by the WAF from the beginning of + * the month, not included in the subscription plans. + */ + extraWafUsage: number + /** + * Cost to date (this month) of the extra requests processed by the WAF that + * were not included in the subscription plans. + */ + extraWafCost?: Money + /** + * Cost of activating WAF add-on (where subscription plan does not include + * WAF). + */ + wafAddOn?: Money + /** + * Detailed costs and usage for all Edge Services subscription plans that were + * activated during the month. + */ + plansUsageDetails: Record /** * Total cost to date (this month) of all Edge Services resources including * active subscription plan, previously active plans, extra pipelines and