Skip to content

Commit 1622440

Browse files
authored
Merge branch 'main' into v1.5559.0
2 parents 795471b + 666c9dc commit 1622440

File tree

5 files changed

+116
-15
lines changed

5 files changed

+116
-15
lines changed

packages/clients/src/api/edge_services/v1alpha1/api.gen.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
unmarshalCheckLbOriginResponse,
3535
unmarshalCheckPEMChainResponse,
3636
unmarshalDNSStage,
37+
unmarshalGetBillingResponse,
3738
unmarshalListBackendStagesResponse,
3839
unmarshalListCacheStagesResponse,
3940
unmarshalListDNSStagesResponse,
@@ -69,6 +70,8 @@ import type {
6970
DeletePipelineRequest,
7071
DeleteTLSStageRequest,
7172
GetBackendStageRequest,
73+
GetBillingRequest,
74+
GetBillingResponse,
7275
GetCacheStageRequest,
7376
GetCurrentPlanRequest,
7477
GetDNSStageRequest,
@@ -826,4 +829,20 @@ export class API extends ParentAPI {
826829
method: 'DELETE',
827830
path: `/edge-services/v1alpha1/current-plan/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`,
828831
})
832+
833+
/**
834+
* Gives information on current edge-services subscription plan and used
835+
* resources with associated price.
836+
*
837+
* @param request - The request {@link GetBillingRequest}
838+
* @returns A Promise of GetBillingResponse
839+
*/
840+
getBilling = (request: Readonly<GetBillingRequest> = {}) =>
841+
this.client.fetch<GetBillingResponse>(
842+
{
843+
method: 'GET',
844+
path: `/edge-services/v1alpha1/billing/${validatePathParam('projectId', request.projectId ?? this.client.settings.defaultProjectId)}`,
845+
},
846+
unmarshalGetBillingResponse,
847+
)
829848
}

packages/clients/src/api/edge_services/v1alpha1/marshalling.gen.ts

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
resolveOneOf,
66
unmarshalArrayOfObject,
77
unmarshalDate,
8+
unmarshalMoney,
89
} from '../../../bridge'
910
import type { DefaultValues } from '../../../bridge'
1011
import type {
@@ -24,6 +25,7 @@ import type {
2425
CreatePurgeRequestRequest,
2526
CreateTLSStageRequest,
2627
DNSStage,
28+
GetBillingResponse,
2729
ListBackendStagesResponse,
2830
ListCacheStagesResponse,
2931
ListDNSStagesResponse,
@@ -288,6 +290,47 @@ export const unmarshalCheckPEMChainResponse = (
288290
} as CheckPEMChainResponse
289291
}
290292

293+
const unmarshalPlanDetails = (data: unknown): PlanDetails => {
294+
if (!isJSONObject(data)) {
295+
throw new TypeError(
296+
`Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary.`,
297+
)
298+
}
299+
300+
return {
301+
packageGb: data.package_gb,
302+
pipelineLimit: data.pipeline_limit,
303+
planName: data.plan_name,
304+
} as PlanDetails
305+
}
306+
307+
export const unmarshalGetBillingResponse = (
308+
data: unknown,
309+
): GetBillingResponse => {
310+
if (!isJSONObject(data)) {
311+
throw new TypeError(
312+
`Unmarshalling the type 'GetBillingResponse' failed as data isn't a dictionary.`,
313+
)
314+
}
315+
316+
return {
317+
currentPlan: data.current_plan
318+
? unmarshalPlanDetails(data.current_plan)
319+
: undefined,
320+
currentPlanCacheUsage: data.current_plan_cache_usage,
321+
extraCacheCost: data.extra_cache_cost
322+
? unmarshalMoney(data.extra_cache_cost)
323+
: undefined,
324+
extraCacheUsage: data.extra_cache_usage,
325+
extraPipelinesCost: data.extra_pipelines_cost
326+
? unmarshalMoney(data.extra_pipelines_cost)
327+
: undefined,
328+
pipelineNumber: data.pipeline_number,
329+
planCost: data.plan_cost ? unmarshalMoney(data.plan_cost) : undefined,
330+
totalCost: data.total_cost ? unmarshalMoney(data.total_cost) : undefined,
331+
} as GetBillingResponse
332+
}
333+
291334
export const unmarshalListBackendStagesResponse = (
292335
data: unknown,
293336
): ListBackendStagesResponse => {
@@ -348,20 +391,6 @@ export const unmarshalListPipelinesResponse = (
348391
} as ListPipelinesResponse
349392
}
350393

351-
const unmarshalPlanDetails = (data: unknown): PlanDetails => {
352-
if (!isJSONObject(data)) {
353-
throw new TypeError(
354-
`Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary.`,
355-
)
356-
}
357-
358-
return {
359-
packageGb: data.package_gb,
360-
pipelineLimit: data.pipeline_limit,
361-
planName: data.plan_name,
362-
} as PlanDetails
363-
}
364-
365394
export const unmarshalListPlansResponse = (
366395
data: unknown,
367396
): ListPlansResponse => {

packages/clients/src/api/edge_services/v1alpha1/types.gen.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file was automatically generated. DO NOT EDIT.
22
// If you have any remark or suggestion do not hesitate to open an issue.
3-
import type { Region, Zone } from '../../../bridge'
3+
import type { Money, Region, Zone } from '../../../bridge'
44

55
export type DNSStageType = 'unknown_type' | 'auto' | 'managed' | 'custom'
66

@@ -279,8 +279,11 @@ export interface CheckPEMChainRequestSecretChain {
279279
}
280280

281281
export interface PlanDetails {
282+
/** Subscription plan name. */
282283
planName: PlanName
284+
/** Amount of egress data from cache included in subscription plan. */
283285
packageGb: number
286+
/** Number of pipeline included in subscription plan. */
284287
pipelineLimit: number
285288
}
286289

@@ -501,6 +504,32 @@ export type GetBackendStageRequest = {
501504
backendStageId: string
502505
}
503506

507+
export type GetBillingRequest = {
508+
projectId?: string
509+
}
510+
511+
export interface GetBillingResponse {
512+
/** Information on the current edge-service subscription plan. */
513+
currentPlan?: PlanDetails
514+
/** Price of the current subscription plan. */
515+
planCost?: Money
516+
/** Total number of pipeline currently configured. */
517+
pipelineNumber: number
518+
/** Cost to date of the pipelines not included in the plans. */
519+
extraPipelinesCost?: Money
520+
/** Total amount of data egressed from cache in current subscription plan. */
521+
currentPlanCacheUsage: number
522+
/** Total amount of data egressed from cache not included in the plans. */
523+
extraCacheUsage: number
524+
/** Cost to date of the data egressed from cache not included in the plans. */
525+
extraCacheCost?: Money
526+
/**
527+
* Total cost to date of edge-service product for the month including current
528+
* plan, previous plans, extra pipelines and extra egress cache data.
529+
*/
530+
totalCost?: Money
531+
}
532+
504533
export type GetCacheStageRequest = {
505534
/** ID of the requested cache stage. */
506535
cacheStageId: string

packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export const unmarshalAPIKey = (data: unknown): APIKey => {
9090
description: data.description,
9191
editable: data.editable,
9292
expiresAt: unmarshalDate(data.expires_at),
93+
managed: data.managed,
9394
secretKey: data.secret_key,
9495
updatedAt: unmarshalDate(data.updated_at),
9596
userId: data.user_id,
@@ -105,9 +106,11 @@ export const unmarshalApplication = (data: unknown): Application => {
105106

106107
return {
107108
createdAt: unmarshalDate(data.created_at),
109+
deletable: data.deletable,
108110
description: data.description,
109111
editable: data.editable,
110112
id: data.id,
113+
managed: data.managed,
111114
name: data.name,
112115
nbApiKeys: data.nb_api_keys,
113116
organizationId: data.organization_id,
@@ -126,8 +129,11 @@ export const unmarshalGroup = (data: unknown): Group => {
126129
return {
127130
applicationIds: data.application_ids,
128131
createdAt: unmarshalDate(data.created_at),
132+
deletable: data.deletable,
129133
description: data.description,
134+
editable: data.editable,
130135
id: data.id,
136+
managed: data.managed,
131137
name: data.name,
132138
organizationId: data.organization_id,
133139
tags: data.tags,
@@ -166,10 +172,12 @@ export const unmarshalPolicy = (data: unknown): Policy => {
166172
return {
167173
applicationId: data.application_id,
168174
createdAt: unmarshalDate(data.created_at),
175+
deletable: data.deletable,
169176
description: data.description,
170177
editable: data.editable,
171178
groupId: data.group_id,
172179
id: data.id,
180+
managed: data.managed,
173181
name: data.name,
174182
nbPermissionSets: data.nb_permission_sets,
175183
nbRules: data.nb_rules,

packages/clients/src/api/iam/v1alpha1/types.gen.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ export interface APIKey {
169169
defaultProjectId: string
170170
/** Defines whether or not the API key is editable. */
171171
editable: boolean
172+
/** Defines whether or not the API key is managed. */
173+
managed: boolean
172174
/** IP address of the device that created the API key. */
173175
creationIp: string
174176
}
@@ -188,6 +190,10 @@ export interface Application {
188190
organizationId: string
189191
/** Defines whether or not the application is editable. */
190192
editable: boolean
193+
/** Defines whether or not the application is deletable. */
194+
deletable: boolean
195+
/** Defines whether or not the application is managed. */
196+
managed: boolean
191197
/** Number of API keys attributed to the application. */
192198
nbApiKeys: number
193199
/** Tags associated with the user. */
@@ -213,6 +219,12 @@ export interface Group {
213219
applicationIds: string[]
214220
/** Tags associated to the group. */
215221
tags: string[]
222+
/** Defines whether or not the group is editable. */
223+
editable: boolean
224+
/** Defines whether or not the group is deletable. */
225+
deletable: boolean
226+
/** Defines whether or not the group is managed. */
227+
managed: boolean
216228
}
217229

218230
export interface Log {
@@ -264,6 +276,10 @@ export interface Policy {
264276
updatedAt?: Date
265277
/** Defines whether or not a policy is editable. */
266278
editable: boolean
279+
/** Defines whether or not a policy is deletable. */
280+
deletable: boolean
281+
/** Defines whether or not a policy is managed. */
282+
managed: boolean
267283
/** Number of rules of the policy. */
268284
nbRules: number
269285
/** Number of policy scopes. */

0 commit comments

Comments
 (0)