Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions packages_generated/audit_trail/src/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import type { ApiLocality } from '@scaleway/sdk-client'
import {
enrichForPagination,
API as ParentAPI,
toApiLocality,
urlParams,
Expand All @@ -14,8 +15,9 @@ import {
unmarshalListAuthenticationEventsResponse,
unmarshalListCombinedEventsResponse,
unmarshalListEventsResponse,
unmarshalListExportJobsResponse,
unmarshalListProductsResponse,
} from './marshalling.gen'
} from './marshalling.gen.js'
import type {
CreateExportJobRequest,
DeleteExportJobRequest,
Expand All @@ -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',
Expand Down Expand Up @@ -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<ListExportJobsRequest> = {},
) =>
this.client.fetch<ListExportJobsResponse>(
{
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<ListExportJobsRequest> = {}) =>
enrichForPagination('exportJobs', this.pageOfListExportJobs, request)
}
3 changes: 3 additions & 0 deletions packages_generated/audit_trail/src/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export type {
ListEventsRequest,
ListEventsRequestOrderBy,
ListEventsResponse,
ListExportJobsRequest,
ListExportJobsRequestOrderBy,
ListExportJobsResponse,
ListProductsRequest,
ListProductsResponse,
LoadBalancerAclInfo,
Expand Down
16 changes: 16 additions & 0 deletions packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import type {
ListCombinedEventsResponse,
ListCombinedEventsResponseCombinedEvent,
ListEventsResponse,
ListExportJobsResponse,
ListProductsResponse,
LoadBalancerAclInfo,
LoadBalancerBackendInfo,
Expand Down Expand Up @@ -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(
Expand Down
115 changes: 77 additions & 38 deletions packages_generated/audit_trail/src/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -444,11 +450,6 @@ export interface SystemEvent {
productName: string
}

export interface ProductService {
name: string
methods: string[]
}

export interface ExportJobS3 {
bucket: string
/**
Expand All @@ -459,6 +460,11 @@ export interface ExportJobS3 {
projectId?: string
}

export interface ProductService {
name: string
methods: string[]
}

export interface ListCombinedEventsResponseCombinedEvent {
/**
*
Expand All @@ -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<string, string>
}

export interface Product {
/**
* Product title.
Expand Down Expand Up @@ -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<string, string>
}

export type ListAuthenticationEventsRequest = {
/**
* Region to target. If none is passed will use default region from the config.
Expand Down Expand Up @@ -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<string, string>
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.
Expand Down
Loading