From 83483b8e5eab6a82e131e2050bd018e2ad707afa Mon Sep 17 00:00:00 2001 From: Scaleway Bot Date: Fri, 29 Nov 2024 17:03:02 +0100 Subject: [PATCH] feat(audit_trail): add Kubernetes ACL resource (#1622) --- .../src/api/audit_trail/v1alpha1/index.gen.ts | 1 + .../audit_trail/v1alpha1/marshalling.gen.ts | 14 +++++++++++ .../src/api/audit_trail/v1alpha1/types.gen.ts | 24 +++++++++++++++---- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/packages/clients/src/api/audit_trail/v1alpha1/index.gen.ts b/packages/clients/src/api/audit_trail/v1alpha1/index.gen.ts index ddef97699..7d4529d8b 100644 --- a/packages/clients/src/api/audit_trail/v1alpha1/index.gen.ts +++ b/packages/clients/src/api/audit_trail/v1alpha1/index.gen.ts @@ -4,6 +4,7 @@ export { API } from './api.gen' export type { Event, EventPrincipal, + KubernetesACLInfo, KubernetesClusterInfo, KubernetesNodeInfo, KubernetesPoolInfo, diff --git a/packages/clients/src/api/audit_trail/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/audit_trail/v1alpha1/marshalling.gen.ts index 525c4cbfe..01aca6837 100644 --- a/packages/clients/src/api/audit_trail/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/audit_trail/v1alpha1/marshalling.gen.ts @@ -8,6 +8,7 @@ import { import type { Event, EventPrincipal, + KubernetesACLInfo, KubernetesClusterInfo, KubernetesNodeInfo, KubernetesPoolInfo, @@ -19,6 +20,16 @@ import type { SecretManagerSecretVersionInfo, } from './types.gen' +const unmarshalKubernetesACLInfo = (data: unknown): KubernetesACLInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'KubernetesACLInfo' failed as data isn't a dictionary.`, + ) + } + + return {} as KubernetesACLInfo +} + const unmarshalKubernetesClusterInfo = ( data: unknown, ): KubernetesClusterInfo => { @@ -108,6 +119,9 @@ export const unmarshalResource = (data: unknown): Resource => { createdAt: unmarshalDate(data.created_at), deletedAt: unmarshalDate(data.deleted_at), id: data.id, + kubeAclInfo: data.kube_acl_info + ? unmarshalKubernetesACLInfo(data.kube_acl_info) + : undefined, kubeClusterInfo: data.kube_cluster_info ? unmarshalKubernetesClusterInfo(data.kube_cluster_info) : undefined, diff --git a/packages/clients/src/api/audit_trail/v1alpha1/types.gen.ts b/packages/clients/src/api/audit_trail/v1alpha1/types.gen.ts index ea1122aef..4fb99cdb0 100644 --- a/packages/clients/src/api/audit_trail/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/audit_trail/v1alpha1/types.gen.ts @@ -11,6 +11,9 @@ export type ResourceType = | 'kube_cluster' | 'kube_pool' | 'kube_node' + | 'kube_acl' + +export interface KubernetesACLInfo {} export interface KubernetesClusterInfo {} @@ -45,29 +48,40 @@ export interface Resource { name?: string /** * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo', - * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo' could be set. + * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be + * set. */ secmSecretInfo?: SecretManagerSecretInfo /** * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo', - * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo' could be set. + * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be + * set. */ secmSecretVersionInfo?: SecretManagerSecretVersionInfo /** * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo', - * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo' could be set. + * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be + * set. */ kubeClusterInfo?: KubernetesClusterInfo /** * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo', - * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo' could be set. + * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be + * set. */ kubePoolInfo?: KubernetesPoolInfo /** * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo', - * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo' could be set. + * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be + * set. */ kubeNodeInfo?: KubernetesNodeInfo + /** + * One-of ('info'): at most one of 'secmSecretInfo', 'secmSecretVersionInfo', + * 'kubeClusterInfo', 'kubePoolInfo', 'kubeNodeInfo', 'kubeAclInfo' could be + * set. + */ + kubeAclInfo?: KubernetesACLInfo } export interface Event {