Skip to content

Commit

Permalink
feat(edge_services): add ListPipelinesWithStages (#1495)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Oct 16, 2024
1 parent 52d2f83 commit c5aab4c
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/clients/src/api/edge_services/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
unmarshalListCacheStagesResponse,
unmarshalListDNSStagesResponse,
unmarshalListPipelinesResponse,
unmarshalListPipelinesWithStagesResponse,
unmarshalListPlansResponse,
unmarshalListPurgeRequestsResponse,
unmarshalListTLSStagesResponse,
Expand Down Expand Up @@ -86,6 +87,8 @@ import type {
ListDNSStagesResponse,
ListPipelinesRequest,
ListPipelinesResponse,
ListPipelinesWithStagesRequest,
ListPipelinesWithStagesResponse,
ListPlansResponse,
ListPurgeRequestsRequest,
ListPurgeRequestsResponse,
Expand Down Expand Up @@ -202,6 +205,37 @@ export class API extends ParentAPI {
options,
)

protected pageOfListPipelinesWithStages = (
request: Readonly<ListPipelinesWithStagesRequest> = {},
) =>
this.client.fetch<ListPipelinesWithStagesResponse>(
{
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<ListPipelinesWithStagesRequest> = {},
) =>
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`,
Expand Down
4 changes: 4 additions & 0 deletions packages/clients/src/api/edge_services/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export type {
ListPipelinesRequest,
ListPipelinesRequestOrderBy,
ListPipelinesResponse,
ListPipelinesWithStagesRequest,
ListPipelinesWithStagesRequestOrderBy,
ListPipelinesWithStagesResponse,
ListPlansResponse,
ListPurgeRequestsRequest,
ListPurgeRequestsRequestOrderBy,
Expand All @@ -61,6 +64,7 @@ export type {
PipelineErrorSeverity,
PipelineErrorStage,
PipelineErrorType,
PipelineStages,
PipelineStatus,
Plan,
PlanDetails,
Expand Down
36 changes: 36 additions & 0 deletions packages/clients/src/api/edge_services/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ import type {
ListCacheStagesResponse,
ListDNSStagesResponse,
ListPipelinesResponse,
ListPipelinesWithStagesResponse,
ListPlansResponse,
ListPurgeRequestsResponse,
ListTLSStagesResponse,
Pipeline,
PipelineError,
PipelineStages,
Plan,
PlanDetails,
PurgeRequest,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 => {
Expand Down
28 changes: 28 additions & 0 deletions packages/clients/src/api/edge_services/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -287,6 +293,14 @@ export interface PlanDetails {
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
Expand Down Expand Up @@ -709,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[]
Expand Down

0 comments on commit c5aab4c

Please sign in to comment.