Skip to content

Commit c32fb2a

Browse files
authored
Merge branch 'main' into v1.7111.0
2 parents 09a3043 + 5298246 commit c32fb2a

File tree

3 files changed

+135
-40
lines changed

3 files changed

+135
-40
lines changed

packages_generated/audit_trail/src/v1alpha1/api.gen.ts

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import type { ApiLocality } from '@scaleway/sdk-client'
55
import {
6+
enrichForPagination,
67
API as ParentAPI,
78
toApiLocality,
89
urlParams,
@@ -14,8 +15,9 @@ import {
1415
unmarshalListAuthenticationEventsResponse,
1516
unmarshalListCombinedEventsResponse,
1617
unmarshalListEventsResponse,
18+
unmarshalListExportJobsResponse,
1719
unmarshalListProductsResponse,
18-
} from './marshalling.gen'
20+
} from './marshalling.gen.js'
1921
import type {
2022
CreateExportJobRequest,
2123
DeleteExportJobRequest,
@@ -26,9 +28,11 @@ import type {
2628
ListCombinedEventsResponse,
2729
ListEventsRequest,
2830
ListEventsResponse,
31+
ListExportJobsRequest,
32+
ListExportJobsResponse,
2933
ListProductsRequest,
3034
ListProductsResponse,
31-
} from './types.gen'
35+
} from './types.gen.js'
3236

3337
const jsonContentHeaders = {
3438
'Content-Type': 'application/json; charset=utf-8',
@@ -193,4 +197,40 @@ export class API extends ParentAPI {
193197
method: 'DELETE',
194198
path: `/audit-trail/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/export-jobs/${validatePathParam('exportJobId', request.exportJobId)}`,
195199
})
200+
201+
protected pageOfListExportJobs = (
202+
request: Readonly<ListExportJobsRequest> = {},
203+
) =>
204+
this.client.fetch<ListExportJobsResponse>(
205+
{
206+
method: 'GET',
207+
path: `/audit-trail/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/export-jobs`,
208+
urlParams: urlParams(
209+
['name', request.name],
210+
['order_by', request.orderBy],
211+
[
212+
'organization_id',
213+
request.organizationId ??
214+
this.client.settings.defaultOrganizationId,
215+
],
216+
['page', request.page],
217+
[
218+
'page_size',
219+
request.pageSize ?? this.client.settings.defaultPageSize,
220+
],
221+
[
222+
'tags',
223+
request.tags
224+
? Object.entries(request.tags).map(
225+
([key, value]) => `${key}:${value}`,
226+
)
227+
: undefined,
228+
],
229+
),
230+
},
231+
unmarshalListExportJobsResponse,
232+
)
233+
234+
listExportJobs = (request: Readonly<ListExportJobsRequest> = {}) =>
235+
enrichForPagination('exportJobs', this.pageOfListExportJobs, request)
196236
}

packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import type {
3232
ListCombinedEventsResponse,
3333
ListCombinedEventsResponseCombinedEvent,
3434
ListEventsResponse,
35+
ListExportJobsResponse,
3536
ListProductsResponse,
3637
LoadBalancerAclInfo,
3738
LoadBalancerBackendInfo,
@@ -610,6 +611,21 @@ export const unmarshalListEventsResponse = (
610611
} as ListEventsResponse
611612
}
612613

614+
export const unmarshalListExportJobsResponse = (
615+
data: unknown,
616+
): ListExportJobsResponse => {
617+
if (!isJSONObject(data)) {
618+
throw new TypeError(
619+
`Unmarshalling the type 'ListExportJobsResponse' failed as data isn't a dictionary.`,
620+
)
621+
}
622+
623+
return {
624+
exportJobs: unmarshalArrayOfObject(data.export_jobs, unmarshalExportJob),
625+
totalCount: data.total_count,
626+
} as ListExportJobsResponse
627+
}
628+
613629
const unmarshalProductService = (data: unknown): ProductService => {
614630
if (!isJSONObject(data)) {
615631
throw new TypeError(

packages_generated/audit_trail/src/v1alpha1/types.gen.ts

Lines changed: 77 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ export type ListCombinedEventsRequestOrderBy =
3434

3535
export type ListEventsRequestOrderBy = 'recorded_at_desc' | 'recorded_at_asc'
3636

37+
export type ListExportJobsRequestOrderBy =
38+
| 'name_asc'
39+
| 'name_desc'
40+
| 'created_at_asc'
41+
| 'created_at_desc'
42+
3743
export type ResourceType =
3844
| 'unknown_type'
3945
| 'secm_secret'
@@ -444,11 +450,6 @@ export interface SystemEvent {
444450
productName: string
445451
}
446452

447-
export interface ProductService {
448-
name: string
449-
methods: string[]
450-
}
451-
452453
export interface ExportJobS3 {
453454
bucket: string
454455
/**
@@ -459,6 +460,11 @@ export interface ExportJobS3 {
459460
projectId?: string
460461
}
461462

463+
export interface ProductService {
464+
name: string
465+
methods: string[]
466+
}
467+
462468
export interface ListCombinedEventsResponseCombinedEvent {
463469
/**
464470
*
@@ -477,6 +483,39 @@ export interface ListCombinedEventsResponseCombinedEvent {
477483
system?: SystemEvent
478484
}
479485

486+
export interface ExportJob {
487+
/**
488+
* ID of the export job.
489+
*/
490+
id: string
491+
/**
492+
* ID of the targeted Organization.
493+
*/
494+
organizationId: string
495+
/**
496+
* Name of the export.
497+
*/
498+
name: string
499+
/**
500+
* Destination in an S3 storage.
501+
*
502+
* One-of ('destination'): at most one of 's3' could be set.
503+
*/
504+
s3?: ExportJobS3
505+
/**
506+
* Export job creation date.
507+
*/
508+
createdAt?: Date
509+
/**
510+
* Last export date.
511+
*/
512+
lastRunAt?: Date
513+
/**
514+
* Tags of the export.
515+
*/
516+
tags: Record<string, string>
517+
}
518+
480519
export interface Product {
481520
/**
482521
* Product title.
@@ -528,39 +567,6 @@ export type DeleteExportJobRequest = {
528567
exportJobId: string
529568
}
530569

531-
export interface ExportJob {
532-
/**
533-
* ID of the export job.
534-
*/
535-
id: string
536-
/**
537-
* ID of the targeted Organization.
538-
*/
539-
organizationId: string
540-
/**
541-
* Name of the export.
542-
*/
543-
name: string
544-
/**
545-
* Destination in an S3 storage.
546-
*
547-
* One-of ('destination'): at most one of 's3' could be set.
548-
*/
549-
s3?: ExportJobS3
550-
/**
551-
* Export job creation date.
552-
*/
553-
createdAt?: Date
554-
/**
555-
* Last export date.
556-
*/
557-
lastRunAt?: Date
558-
/**
559-
* Tags of the export.
560-
*/
561-
tags: Record<string, string>
562-
}
563-
564570
export type ListAuthenticationEventsRequest = {
565571
/**
566572
* Region to target. If none is passed will use default region from the config.
@@ -668,6 +674,39 @@ export interface ListEventsResponse {
668674
nextPageToken?: string
669675
}
670676

677+
export type ListExportJobsRequest = {
678+
/**
679+
* Region to target. If none is passed will use default region from the config.
680+
*/
681+
region?: ScwRegion
682+
/**
683+
* Filter by Organization ID.
684+
*/
685+
organizationId?: string
686+
/**
687+
* (Optional) Filter by export name.
688+
*/
689+
name?: string
690+
/**
691+
* (Optional) List of tags to filter on.
692+
*/
693+
tags?: Record<string, string>
694+
page?: number
695+
pageSize?: number
696+
orderBy?: ListExportJobsRequestOrderBy
697+
}
698+
699+
export interface ListExportJobsResponse {
700+
/**
701+
* Single page of export jobs matching the requested criteria.
702+
*/
703+
exportJobs: ExportJob[]
704+
/**
705+
* Total count of export jobs matching the requested criteria.
706+
*/
707+
totalCount: number
708+
}
709+
671710
export type ListProductsRequest = {
672711
/**
673712
* Region to target. If none is passed will use default region from the config.

0 commit comments

Comments
 (0)