diff --git a/packages_generated/audit_trail/src/v1alpha1/api.gen.ts b/packages_generated/audit_trail/src/v1alpha1/api.gen.ts index e69acd475..762f9a09e 100644 --- a/packages_generated/audit_trail/src/v1alpha1/api.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/api.gen.ts @@ -3,6 +3,7 @@ import type { ApiLocality } from '@scaleway/sdk-client' import { + enrichForPagination, API as ParentAPI, toApiLocality, urlParams, @@ -14,8 +15,9 @@ import { unmarshalListAuthenticationEventsResponse, unmarshalListCombinedEventsResponse, unmarshalListEventsResponse, + unmarshalListExportJobsResponse, unmarshalListProductsResponse, -} from './marshalling.gen' +} from './marshalling.gen.js' import type { CreateExportJobRequest, DeleteExportJobRequest, @@ -26,9 +28,11 @@ import type { ListCombinedEventsResponse, ListEventsRequest, ListEventsResponse, + ListExportJobsRequest, + ListExportJobsResponse, ListProductsRequest, ListProductsResponse, -} from './types.gen' +} from './types.gen.js' const jsonContentHeaders = { 'Content-Type': 'application/json; charset=utf-8', @@ -193,4 +197,40 @@ export class API extends ParentAPI { method: 'DELETE', path: `/audit-trail/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/export-jobs/${validatePathParam('exportJobId', request.exportJobId)}`, }) + + protected pageOfListExportJobs = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/audit-trail/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/export-jobs`, + urlParams: urlParams( + ['name', request.name], + ['order_by', request.orderBy], + [ + 'organization_id', + request.organizationId ?? + this.client.settings.defaultOrganizationId, + ], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + [ + 'tags', + request.tags + ? Object.entries(request.tags).map( + ([key, value]) => `${key}:${value}`, + ) + : undefined, + ], + ), + }, + unmarshalListExportJobsResponse, + ) + + listExportJobs = (request: Readonly = {}) => + enrichForPagination('exportJobs', this.pageOfListExportJobs, request) } diff --git a/packages_generated/audit_trail/src/v1alpha1/index.gen.ts b/packages_generated/audit_trail/src/v1alpha1/index.gen.ts index e95b832dd..f65213cda 100644 --- a/packages_generated/audit_trail/src/v1alpha1/index.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/index.gen.ts @@ -38,6 +38,9 @@ export type { ListEventsRequest, ListEventsRequestOrderBy, ListEventsResponse, + ListExportJobsRequest, + ListExportJobsRequestOrderBy, + ListExportJobsResponse, ListProductsRequest, ListProductsResponse, LoadBalancerAclInfo, diff --git a/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts b/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts index 7bc90e6b4..02c1b17f1 100644 --- a/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts @@ -32,6 +32,7 @@ import type { ListCombinedEventsResponse, ListCombinedEventsResponseCombinedEvent, ListEventsResponse, + ListExportJobsResponse, ListProductsResponse, LoadBalancerAclInfo, LoadBalancerBackendInfo, @@ -610,6 +611,21 @@ export const unmarshalListEventsResponse = ( } as ListEventsResponse } +export const unmarshalListExportJobsResponse = ( + data: unknown, +): ListExportJobsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListExportJobsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + exportJobs: unmarshalArrayOfObject(data.export_jobs, unmarshalExportJob), + totalCount: data.total_count, + } as ListExportJobsResponse +} + const unmarshalProductService = (data: unknown): ProductService => { if (!isJSONObject(data)) { throw new TypeError( diff --git a/packages_generated/audit_trail/src/v1alpha1/types.gen.ts b/packages_generated/audit_trail/src/v1alpha1/types.gen.ts index 1c1c1c4bb..381bb294d 100644 --- a/packages_generated/audit_trail/src/v1alpha1/types.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/types.gen.ts @@ -34,6 +34,12 @@ export type ListCombinedEventsRequestOrderBy = export type ListEventsRequestOrderBy = 'recorded_at_desc' | 'recorded_at_asc' +export type ListExportJobsRequestOrderBy = + | 'name_asc' + | 'name_desc' + | 'created_at_asc' + | 'created_at_desc' + export type ResourceType = | 'unknown_type' | 'secm_secret' @@ -444,11 +450,6 @@ export interface SystemEvent { productName: string } -export interface ProductService { - name: string - methods: string[] -} - export interface ExportJobS3 { bucket: string /** @@ -459,6 +460,11 @@ export interface ExportJobS3 { projectId?: string } +export interface ProductService { + name: string + methods: string[] +} + export interface ListCombinedEventsResponseCombinedEvent { /** * @@ -477,6 +483,39 @@ export interface ListCombinedEventsResponseCombinedEvent { system?: SystemEvent } +export interface ExportJob { + /** + * ID of the export job. + */ + id: string + /** + * ID of the targeted Organization. + */ + organizationId: string + /** + * Name of the export. + */ + name: string + /** + * Destination in an S3 storage. + * + * One-of ('destination'): at most one of 's3' could be set. + */ + s3?: ExportJobS3 + /** + * Export job creation date. + */ + createdAt?: Date + /** + * Last export date. + */ + lastRunAt?: Date + /** + * Tags of the export. + */ + tags: Record +} + export interface Product { /** * Product title. @@ -528,39 +567,6 @@ export type DeleteExportJobRequest = { exportJobId: string } -export interface ExportJob { - /** - * ID of the export job. - */ - id: string - /** - * ID of the targeted Organization. - */ - organizationId: string - /** - * Name of the export. - */ - name: string - /** - * Destination in an S3 storage. - * - * One-of ('destination'): at most one of 's3' could be set. - */ - s3?: ExportJobS3 - /** - * Export job creation date. - */ - createdAt?: Date - /** - * Last export date. - */ - lastRunAt?: Date - /** - * Tags of the export. - */ - tags: Record -} - export type ListAuthenticationEventsRequest = { /** * Region to target. If none is passed will use default region from the config. @@ -668,6 +674,39 @@ export interface ListEventsResponse { nextPageToken?: string } +export type ListExportJobsRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * Filter by Organization ID. + */ + organizationId?: string + /** + * (Optional) Filter by export name. + */ + name?: string + /** + * (Optional) List of tags to filter on. + */ + tags?: Record + page?: number + pageSize?: number + orderBy?: ListExportJobsRequestOrderBy +} + +export interface ListExportJobsResponse { + /** + * Single page of export jobs matching the requested criteria. + */ + exportJobs: ExportJob[] + /** + * Total count of export jobs matching the requested criteria. + */ + totalCount: number +} + export type ListProductsRequest = { /** * Region to target. If none is passed will use default region from the config.