From 821dc774db77aa89009a5557542be345849d678a Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Tue, 9 Sep 2025 14:53:03 +0000 Subject: [PATCH] feat: update generated APIs --- .../audit_trail/src/v1alpha1/api.gen.ts | 37 ++++++ .../audit_trail/src/v1alpha1/index.gen.ts | 9 ++ .../src/v1alpha1/marshalling.gen.ts | 88 +++++++++---- .../audit_trail/src/v1alpha1/types.gen.ts | 121 ++++++++++++++++-- .../src/v1alpha1/validation-rules.gen.ts | 7 + packages_generated/std/src/index.gen.ts | 5 +- .../webhosting/src/v1/index.gen.ts | 7 + 7 files changed, 241 insertions(+), 33 deletions(-) diff --git a/packages_generated/audit_trail/src/v1alpha1/api.gen.ts b/packages_generated/audit_trail/src/v1alpha1/api.gen.ts index 1e5adb618..602b34b85 100644 --- a/packages_generated/audit_trail/src/v1alpha1/api.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/api.gen.ts @@ -9,10 +9,13 @@ import { validatePathParam, } from '@scaleway/sdk-client' import { + unmarshalListAuthenticationEventsResponse, unmarshalListEventsResponse, unmarshalListProductsResponse, } from './marshalling.gen' import type { + ListAuthenticationEventsRequest, + ListAuthenticationEventsResponse, ListEventsRequest, ListEventsResponse, ListProductsRequest, @@ -57,6 +60,7 @@ export class API extends ParentAPI { request.pageSize ?? this.client.settings.defaultPageSize, ], ['page_token', request.pageToken], + ['principal_id', request.principalId], ['product_name', request.productName], ['project_id', request.projectId], ['recorded_after', request.recordedAfter], @@ -64,12 +68,45 @@ export class API extends ParentAPI { ['resource_id', request.resourceId], ['resource_type', request.resourceType], ['service_name', request.serviceName], + ['source_ip', request.sourceIp], ['status', request.status], ), }, unmarshalListEventsResponse, ) + /** + * List authentication events. Retrieve the list of Audit Trail authentication events for a Scaleway Organization. You must specify the `organization_id`. + * + * @param request - The request {@link ListAuthenticationEventsRequest} + * @returns A Promise of ListAuthenticationEventsResponse + */ + listAuthenticationEvents = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/audit-trail/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/authentication-events`, + urlParams: urlParams( + ['order_by', request.orderBy], + [ + 'organization_id', + request.organizationId ?? + this.client.settings.defaultOrganizationId, + ], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['page_token', request.pageToken], + ['recorded_after', request.recordedAfter], + ['recorded_before', request.recordedBefore], + ), + }, + unmarshalListAuthenticationEventsResponse, + ) + /** * Retrieve the list of Scaleway resources for which you have Audit Trail events. * diff --git a/packages_generated/audit_trail/src/v1alpha1/index.gen.ts b/packages_generated/audit_trail/src/v1alpha1/index.gen.ts index dd8903407..ea4d0ec03 100644 --- a/packages_generated/audit_trail/src/v1alpha1/index.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/index.gen.ts @@ -7,6 +7,12 @@ export type { AccountProjectInfo, AccountUserInfo, AppleSiliconServerInfo, + AuthenticationEvent, + AuthenticationEventFailureReason, + AuthenticationEventMethod, + AuthenticationEventMFAType, + AuthenticationEventOrigin, + AuthenticationEventResult, BaremetalServerInfo, BaremetalSettingInfo, Event, @@ -19,6 +25,9 @@ export type { KubernetesClusterInfo, KubernetesNodeInfo, KubernetesPoolInfo, + ListAuthenticationEventsRequest, + ListAuthenticationEventsRequestOrderBy, + ListAuthenticationEventsResponse, ListEventsRequest, ListEventsRequestOrderBy, ListEventsResponse, diff --git a/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts b/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts index e006e205d..e9580f1a6 100644 --- a/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts @@ -10,6 +10,7 @@ import type { AccountProjectInfo, AccountUserInfo, AppleSiliconServerInfo, + AuthenticationEvent, BaremetalServerInfo, BaremetalSettingInfo, Event, @@ -22,6 +23,7 @@ import type { KubernetesClusterInfo, KubernetesNodeInfo, KubernetesPoolInfo, + ListAuthenticationEventsResponse, ListEventsResponse, ListProductsResponse, LoadBalancerAclInfo, @@ -323,30 +325,6 @@ const unmarshalSecretManagerSecretVersionInfo = ( } as SecretManagerSecretVersionInfo } -const unmarshalEventPrincipal = (data: unknown): EventPrincipal => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary.`, - ) - } - - return { - id: data.id, - } as EventPrincipal -} - -const unmarshalEventSystem = (data: unknown): EventSystem => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'EventSystem' failed as data isn't a dictionary.`, - ) - } - - return { - name: data.name, - } as EventSystem -} - export const unmarshalResource = (data: unknown): Resource => { if (!isJSONObject(data)) { throw new TypeError( @@ -443,6 +421,68 @@ export const unmarshalResource = (data: unknown): Resource => { } as Resource } +const unmarshalAuthenticationEvent = (data: unknown): AuthenticationEvent => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'AuthenticationEvent' failed as data isn't a dictionary.`, + ) + } + + return { + countryCode: data.country_code ? data.country_code : undefined, + failureReason: data.failure_reason ? data.failure_reason : undefined, + id: data.id, + method: data.method, + mfaType: data.mfa_type ? data.mfa_type : undefined, + organizationId: data.organization_id, + origin: data.origin, + recordedAt: unmarshalDate(data.recorded_at), + resources: unmarshalArrayOfObject(data.resources, unmarshalResource), + result: data.result, + sourceIp: data.source_ip, + userAgent: data.user_agent, + } as AuthenticationEvent +} + +export const unmarshalListAuthenticationEventsResponse = ( + data: unknown, +): ListAuthenticationEventsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListAuthenticationEventsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + events: unmarshalArrayOfObject(data.events, unmarshalAuthenticationEvent), + nextPageToken: data.next_page_token, + } as ListAuthenticationEventsResponse +} + +const unmarshalEventPrincipal = (data: unknown): EventPrincipal => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + } as EventPrincipal +} + +const unmarshalEventSystem = (data: unknown): EventSystem => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EventSystem' failed as data isn't a dictionary.`, + ) + } + + return { + name: data.name, + } as EventSystem +} + export const unmarshalEvent = (data: unknown): Event => { 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 7c1c30857..1b96444ae 100644 --- a/packages_generated/audit_trail/src/v1alpha1/types.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/types.gen.ts @@ -1,6 +1,32 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. import type { Region as ScwRegion } from '@scaleway/sdk-client' +import type { CountryCode as StdCountryCode } from '@scaleway/sdk-std' + +export type AuthenticationEventFailureReason = + | 'unknown_failure_reason' + | 'invalid_mfa' + | 'invalid_password' + +export type AuthenticationEventMFAType = 'unknown_mfa_type' | 'totp' + +export type AuthenticationEventMethod = + | 'unknown_method' + | 'password' + | 'authentication_code' + | 'oauth2' + | 'saml' + +export type AuthenticationEventOrigin = + | 'unknown_origin' + | 'public_api' + | 'admin_api' + +export type AuthenticationEventResult = 'unknown_result' | 'success' | 'failure' + +export type ListAuthenticationEventsRequestOrderBy = + | 'recorded_at_desc' + | 'recorded_at_asc' export type ListEventsRequestOrderBy = 'recorded_at_desc' | 'recorded_at_asc' @@ -45,6 +71,8 @@ export type ResourceType = | 'load_balancer_route' | 'load_balancer_acl' | 'load_balancer_certificate' + | 'sfs_filesystem' + | 'vpc_private_network' export interface AccountOrganizationInfo {} @@ -137,14 +165,6 @@ export interface SecretManagerSecretVersionInfo { revision: number } -export interface EventPrincipal { - id: string -} - -export interface EventSystem { - name: string -} - export interface Resource { id: string type: ResourceType @@ -283,11 +303,70 @@ export interface Resource { loadBalancerCertificateInfo?: LoadBalancerCertificateInfo } +export interface EventPrincipal { + id: string +} + +export interface EventSystem { + name: string +} + export interface ProductService { name: string methods: string[] } +export interface AuthenticationEvent { + /** + * ID of the event. + */ + id: string + /** + * Timestamp of the event. + */ + recordedAt?: Date + /** + * Organization ID containing the event. + */ + organizationId: string + /** + * IP address at the origin of the event. + */ + sourceIp: string + /** + * User Agent at the origin of the event. + */ + userAgent?: string + /** + * Resources attached to the event. + */ + resources: Resource[] + /** + * Result of the authentication attempt. + */ + result: AuthenticationEventResult + /** + * (Optional) Reason for authentication failure. + */ + failureReason?: AuthenticationEventFailureReason + /** + * (Optional) ISO 3166-1 alpha-2 country code of the source IP. + */ + countryCode?: StdCountryCode + /** + * Authentication method used. + */ + method: AuthenticationEventMethod + /** + * Origin of the authentication attempt. + */ + origin: AuthenticationEventOrigin + /** + * (Optional) MFA type used for the authentication attempt. + */ + mfaType?: AuthenticationEventMFAType +} + export interface Event { /** * ID of the event. @@ -374,6 +453,24 @@ export interface Product { services: ProductService[] } +export type ListAuthenticationEventsRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + organizationId?: string + recordedAfter?: Date + recordedBefore?: Date + orderBy?: ListAuthenticationEventsRequestOrderBy + pageSize?: number + pageToken?: string +} + +export interface ListAuthenticationEventsResponse { + events: AuthenticationEvent[] + nextPageToken?: string +} + export type ListEventsRequest = { /** * Region to target. If none is passed will use default region from the config. @@ -422,6 +519,14 @@ export type ListEventsRequest = { * (Optional) ID of the Scaleway resource. */ resourceId?: string + /** + * (Optional) ID of the User or IAM application at the origin of the event. + */ + principalId?: string + /** + * (Optional) IP address at the origin of the event. + */ + sourceIp?: string } export interface ListEventsResponse { diff --git a/packages_generated/audit_trail/src/v1alpha1/validation-rules.gen.ts b/packages_generated/audit_trail/src/v1alpha1/validation-rules.gen.ts index e8cf3840c..6cf0b001e 100644 --- a/packages_generated/audit_trail/src/v1alpha1/validation-rules.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/validation-rules.gen.ts @@ -1,6 +1,13 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. +export const ListAuthenticationEventsRequest = { + pageSize: { + greaterThanOrEqual: 1, + lessThanOrEqual: 1000, + }, +} + export const ListEventsRequest = { methodName: { pattern: /^[a-zA-Z][a-zA-Z0-9_]*$/, diff --git a/packages_generated/std/src/index.gen.ts b/packages_generated/std/src/index.gen.ts index 156220bde..63c6940eb 100644 --- a/packages_generated/std/src/index.gen.ts +++ b/packages_generated/std/src/index.gen.ts @@ -1,3 +1,6 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. -export type { LanguageCode } from './types.gen' +export type { + CountryCode, + LanguageCode, +} from './types.gen' diff --git a/packages_generated/webhosting/src/v1/index.gen.ts b/packages_generated/webhosting/src/v1/index.gen.ts index fc01d5d4b..c09415f93 100644 --- a/packages_generated/webhosting/src/v1/index.gen.ts +++ b/packages_generated/webhosting/src/v1/index.gen.ts @@ -5,6 +5,7 @@ export { ControlPanelAPI, DatabaseAPI, DnsAPI, + FreeDomainAPI, FtpAccountAPI, HostingAPI, MailAccountAPI, @@ -25,6 +26,8 @@ export type { BackupItemGroup, BackupItemType, BackupStatus, + CheckFreeDomainAvailabilityResponse, + CheckFreeDomainAvailabilityResponseUnavailableReason, CheckUserOwnsDomainResponse, ControlPanel, ControlPanelApiListControlPanelsRequest, @@ -61,6 +64,9 @@ export type { DomainDnsAction, DomainStatus, DomainZoneOwner, + FreeDomain, + FreeDomainApiCheckFreeDomainAvailabilityRequest, + FreeDomainApiListFreeRootDomainsRequest, FtpAccount, FtpAccountApiChangeFtpAccountPasswordRequest, FtpAccountApiCreateFtpAccountRequest, @@ -90,6 +96,7 @@ export type { ListDatabasesResponse, ListDatabaseUsersRequestOrderBy, ListDatabaseUsersResponse, + ListFreeRootDomainsResponse, ListFtpAccountsRequestOrderBy, ListFtpAccountsResponse, ListHostingsRequestOrderBy,