import type { V1Secret } from '@kubernetes/client-node'; import type { K8sClient } from '$lib/server/k8s'; import { K8sResource } from '$lib/server/resources/k8s'; import type { ResourceEvent } from '$lib/types/events'; import type { CoreResources } from '$lib/types/workspace'; import type { SecretResources } from '.'; class K8sSecretResourceImpl extends K8sResource { constructor(k8sClient: K8sClient, namespace: string) { super( k8sClient, namespace, { group: '', version: 'v1', namespace, resource: 'secrets', }, [], ); } } class K8sSecretResources implements SecretResources { #secretResources: K8sSecretResourceImpl; constructor(k8sClient: K8sClient, namespace: string) { this.#secretResources = new K8sSecretResourceImpl(k8sClient, namespace); } subscribe(handler: (event: ResourceEvent) => void): () => void { return this.#secretResources.subscribe(handler); } async getSecrets(): Promise { return this.#secretResources.getResources(); } async getSecretResources(secretId: string): Promise { return this.#secretResources.getCoreResources(secretId); } async getSecretStatus(secretId: string): Promise { return undefined; } async applySecret(cr: V1Secret): Promise { await this.#secretResources.apply(cr); } async deleteSecret(id: string): Promise { await this.#secretResources.remove(id); } } export { K8sSecretResources };