Skip to content

Commit c4a7c26

Browse files
committed
feat: update generated APIs
1 parent 282fd41 commit c4a7c26

File tree

7 files changed

+231
-33
lines changed

7 files changed

+231
-33
lines changed

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ import {
99
validatePathParam,
1010
} from '@scaleway/sdk-client'
1111
import {
12+
unmarshalListAuthenticationEventsResponse,
1213
unmarshalListEventsResponse,
1314
unmarshalListProductsResponse,
1415
} from './marshalling.gen'
1516
import type {
17+
ListAuthenticationEventsRequest,
18+
ListAuthenticationEventsResponse,
1619
ListEventsRequest,
1720
ListEventsResponse,
1821
ListProductsRequest,
@@ -70,6 +73,38 @@ export class API extends ParentAPI {
7073
unmarshalListEventsResponse,
7174
)
7275

76+
/**
77+
* List authentication events. Retrieve the list of Audit Trail authentication events for a Scaleway Organization. You must specify the `organization_id`.
78+
*
79+
* @param request - The request {@link ListAuthenticationEventsRequest}
80+
* @returns A Promise of ListAuthenticationEventsResponse
81+
*/
82+
listAuthenticationEvents = (
83+
request: Readonly<ListAuthenticationEventsRequest> = {},
84+
) =>
85+
this.client.fetch<ListAuthenticationEventsResponse>(
86+
{
87+
method: 'GET',
88+
path: `/audit-trail/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/authentication-events`,
89+
urlParams: urlParams(
90+
['order_by', request.orderBy],
91+
[
92+
'organization_id',
93+
request.organizationId ??
94+
this.client.settings.defaultOrganizationId,
95+
],
96+
[
97+
'page_size',
98+
request.pageSize ?? this.client.settings.defaultPageSize,
99+
],
100+
['page_token', request.pageToken],
101+
['recorded_after', request.recordedAfter],
102+
['recorded_before', request.recordedBefore],
103+
),
104+
},
105+
unmarshalListAuthenticationEventsResponse,
106+
)
107+
73108
/**
74109
* Retrieve the list of Scaleway resources for which you have Audit Trail events.
75110
*

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ export type {
77
AccountProjectInfo,
88
AccountUserInfo,
99
AppleSiliconServerInfo,
10+
AuthenticationEvent,
11+
AuthenticationEventFailureReason,
12+
AuthenticationEventMethod,
13+
AuthenticationEventMFAType,
14+
AuthenticationEventOrigin,
15+
AuthenticationEventResult,
1016
BaremetalServerInfo,
1117
BaremetalSettingInfo,
1218
Event,
@@ -19,6 +25,9 @@ export type {
1925
KubernetesClusterInfo,
2026
KubernetesNodeInfo,
2127
KubernetesPoolInfo,
28+
ListAuthenticationEventsRequest,
29+
ListAuthenticationEventsRequestOrderBy,
30+
ListAuthenticationEventsResponse,
2231
ListEventsRequest,
2332
ListEventsRequestOrderBy,
2433
ListEventsResponse,

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

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type {
1010
AccountProjectInfo,
1111
AccountUserInfo,
1212
AppleSiliconServerInfo,
13+
AuthenticationEvent,
1314
BaremetalServerInfo,
1415
BaremetalSettingInfo,
1516
Event,
@@ -22,6 +23,7 @@ import type {
2223
KubernetesClusterInfo,
2324
KubernetesNodeInfo,
2425
KubernetesPoolInfo,
26+
ListAuthenticationEventsResponse,
2527
ListEventsResponse,
2628
ListProductsResponse,
2729
LoadBalancerAclInfo,
@@ -323,30 +325,6 @@ const unmarshalSecretManagerSecretVersionInfo = (
323325
} as SecretManagerSecretVersionInfo
324326
}
325327

326-
const unmarshalEventPrincipal = (data: unknown): EventPrincipal => {
327-
if (!isJSONObject(data)) {
328-
throw new TypeError(
329-
`Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary.`,
330-
)
331-
}
332-
333-
return {
334-
id: data.id,
335-
} as EventPrincipal
336-
}
337-
338-
const unmarshalEventSystem = (data: unknown): EventSystem => {
339-
if (!isJSONObject(data)) {
340-
throw new TypeError(
341-
`Unmarshalling the type 'EventSystem' failed as data isn't a dictionary.`,
342-
)
343-
}
344-
345-
return {
346-
name: data.name,
347-
} as EventSystem
348-
}
349-
350328
export const unmarshalResource = (data: unknown): Resource => {
351329
if (!isJSONObject(data)) {
352330
throw new TypeError(
@@ -443,6 +421,68 @@ export const unmarshalResource = (data: unknown): Resource => {
443421
} as Resource
444422
}
445423

424+
const unmarshalAuthenticationEvent = (data: unknown): AuthenticationEvent => {
425+
if (!isJSONObject(data)) {
426+
throw new TypeError(
427+
`Unmarshalling the type 'AuthenticationEvent' failed as data isn't a dictionary.`,
428+
)
429+
}
430+
431+
return {
432+
countryCode: data.country_code ? data.country_code : undefined,
433+
failureReason: data.failure_reason ? data.failure_reason : undefined,
434+
id: data.id,
435+
method: data.method,
436+
mfaType: data.mfa_type ? data.mfa_type : undefined,
437+
organizationId: data.organization_id,
438+
origin: data.origin,
439+
recordedAt: unmarshalDate(data.recorded_at),
440+
resources: unmarshalArrayOfObject(data.resources, unmarshalResource),
441+
result: data.result,
442+
sourceIp: data.source_ip,
443+
userAgent: data.user_agent,
444+
} as AuthenticationEvent
445+
}
446+
447+
export const unmarshalListAuthenticationEventsResponse = (
448+
data: unknown,
449+
): ListAuthenticationEventsResponse => {
450+
if (!isJSONObject(data)) {
451+
throw new TypeError(
452+
`Unmarshalling the type 'ListAuthenticationEventsResponse' failed as data isn't a dictionary.`,
453+
)
454+
}
455+
456+
return {
457+
events: unmarshalArrayOfObject(data.events, unmarshalAuthenticationEvent),
458+
nextPageToken: data.next_page_token,
459+
} as ListAuthenticationEventsResponse
460+
}
461+
462+
const unmarshalEventPrincipal = (data: unknown): EventPrincipal => {
463+
if (!isJSONObject(data)) {
464+
throw new TypeError(
465+
`Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary.`,
466+
)
467+
}
468+
469+
return {
470+
id: data.id,
471+
} as EventPrincipal
472+
}
473+
474+
const unmarshalEventSystem = (data: unknown): EventSystem => {
475+
if (!isJSONObject(data)) {
476+
throw new TypeError(
477+
`Unmarshalling the type 'EventSystem' failed as data isn't a dictionary.`,
478+
)
479+
}
480+
481+
return {
482+
name: data.name,
483+
} as EventSystem
484+
}
485+
446486
export const unmarshalEvent = (data: unknown): Event => {
447487
if (!isJSONObject(data)) {
448488
throw new TypeError(

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

Lines changed: 105 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
// This file was automatically generated. DO NOT EDIT.
22
// If you have any remark or suggestion do not hesitate to open an issue.
33
import type { Region as ScwRegion } from '@scaleway/sdk-client'
4+
import type { CountryCode as StdCountryCode } from '@scaleway/sdk-std'
5+
6+
export type AuthenticationEventFailureReason =
7+
| 'unknown_failure_reason'
8+
| 'invalid_mfa'
9+
| 'invalid_password'
10+
11+
export type AuthenticationEventMFAType = 'unknown_mfa_type' | 'totp'
12+
13+
export type AuthenticationEventMethod =
14+
| 'unknown_method'
15+
| 'password'
16+
| 'authentication_code'
17+
| 'oauth2'
18+
| 'saml'
19+
20+
export type AuthenticationEventOrigin =
21+
| 'unknown_origin'
22+
| 'public_api'
23+
| 'admin_api'
24+
25+
export type AuthenticationEventResult = 'unknown_result' | 'success' | 'failure'
26+
27+
export type ListAuthenticationEventsRequestOrderBy =
28+
| 'recorded_at_desc'
29+
| 'recorded_at_asc'
430

531
export type ListEventsRequestOrderBy = 'recorded_at_desc' | 'recorded_at_asc'
632

@@ -45,6 +71,8 @@ export type ResourceType =
4571
| 'load_balancer_route'
4672
| 'load_balancer_acl'
4773
| 'load_balancer_certificate'
74+
| 'sfs_filesystem'
75+
| 'vpc_private_network'
4876

4977
export interface AccountOrganizationInfo {}
5078

@@ -137,14 +165,6 @@ export interface SecretManagerSecretVersionInfo {
137165
revision: number
138166
}
139167

140-
export interface EventPrincipal {
141-
id: string
142-
}
143-
144-
export interface EventSystem {
145-
name: string
146-
}
147-
148168
export interface Resource {
149169
id: string
150170
type: ResourceType
@@ -283,11 +303,70 @@ export interface Resource {
283303
loadBalancerCertificateInfo?: LoadBalancerCertificateInfo
284304
}
285305

306+
export interface EventPrincipal {
307+
id: string
308+
}
309+
310+
export interface EventSystem {
311+
name: string
312+
}
313+
286314
export interface ProductService {
287315
name: string
288316
methods: string[]
289317
}
290318

319+
export interface AuthenticationEvent {
320+
/**
321+
* ID of the event.
322+
*/
323+
id: string
324+
/**
325+
* Timestamp of the event.
326+
*/
327+
recordedAt?: Date
328+
/**
329+
* Organization ID containing the event.
330+
*/
331+
organizationId: string
332+
/**
333+
* IP address at the origin of the event.
334+
*/
335+
sourceIp: string
336+
/**
337+
* User Agent at the origin of the event.
338+
*/
339+
userAgent?: string
340+
/**
341+
* Resources attached to the event.
342+
*/
343+
resources: Resource[]
344+
/**
345+
* Result of the authentication attempt.
346+
*/
347+
result: AuthenticationEventResult
348+
/**
349+
* (Optional) Reason for authentication failure.
350+
*/
351+
failureReason?: AuthenticationEventFailureReason
352+
/**
353+
* (Optional) ISO 3166-1 alpha-2 country code of the source IP.
354+
*/
355+
countryCode?: StdCountryCode
356+
/**
357+
* Authentication method used.
358+
*/
359+
method: AuthenticationEventMethod
360+
/**
361+
* Origin of the authentication attempt.
362+
*/
363+
origin: AuthenticationEventOrigin
364+
/**
365+
* (Optional) MFA type used for the authentication attempt.
366+
*/
367+
mfaType?: AuthenticationEventMFAType
368+
}
369+
291370
export interface Event {
292371
/**
293372
* ID of the event.
@@ -374,6 +453,24 @@ export interface Product {
374453
services: ProductService[]
375454
}
376455

456+
export type ListAuthenticationEventsRequest = {
457+
/**
458+
* Region to target. If none is passed will use default region from the config.
459+
*/
460+
region?: ScwRegion
461+
organizationId?: string
462+
recordedAfter?: Date
463+
recordedBefore?: Date
464+
orderBy?: ListAuthenticationEventsRequestOrderBy
465+
pageSize?: number
466+
pageToken?: string
467+
}
468+
469+
export interface ListAuthenticationEventsResponse {
470+
events: AuthenticationEvent[]
471+
nextPageToken?: string
472+
}
473+
377474
export type ListEventsRequest = {
378475
/**
379476
* Region to target. If none is passed will use default region from the config.

packages_generated/audit_trail/src/v1alpha1/validation-rules.gen.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
// This file was automatically generated. DO NOT EDIT.
22
// If you have any remark or suggestion do not hesitate to open an issue.
33

4+
export const ListAuthenticationEventsRequest = {
5+
pageSize: {
6+
greaterThanOrEqual: 1,
7+
lessThanOrEqual: 1000,
8+
},
9+
}
10+
411
export const ListEventsRequest = {
512
methodName: {
613
pattern: /^[a-zA-Z][a-zA-Z0-9_]*$/,
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +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-
export type { LanguageCode } from './types.gen'
3+
export type {
4+
CountryCode,
5+
LanguageCode,
6+
} from './types.gen'

0 commit comments

Comments
 (0)