mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 22:46:24 +00:00
feat: allow k8 dynamic secret multi namespace and show proper error
This commit is contained in:
@@ -2,6 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { DynamicSecretProviders } from "../dynamicSecret/types";
|
||||
import { dynamicSecretLeaseKeys } from "./queries";
|
||||
import {
|
||||
TCreateDynamicSecretLeaseDTO,
|
||||
@@ -19,6 +20,14 @@ export const useCreateDynamicSecretLease = () => {
|
||||
TCreateDynamicSecretLeaseDTO
|
||||
>({
|
||||
mutationFn: async (dto) => {
|
||||
if (dto.provider === DynamicSecretProviders.Kubernetes) {
|
||||
const { data } = await apiRequest.post<{ lease: TDynamicSecretLease; data: unknown }>(
|
||||
"/api/v1/dynamic-secrets/leases/kubernetes",
|
||||
dto
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
const { data } = await apiRequest.post<{ lease: TDynamicSecretLease; data: unknown }>(
|
||||
"/api/v1/dynamic-secrets/leases",
|
||||
dto
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { DynamicSecretProviders } from "../dynamicSecret/types";
|
||||
|
||||
export enum DynamicSecretLeaseStatus {
|
||||
FailedDeletion = "Failed to delete"
|
||||
}
|
||||
@@ -13,12 +15,20 @@ export type TDynamicSecretLease = {
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type TDynamicSecretKubernetesLeaseConfig = {
|
||||
namespace?: string;
|
||||
};
|
||||
|
||||
export type TDynamicSecretLeaseConfig = TDynamicSecretKubernetesLeaseConfig;
|
||||
|
||||
export type TCreateDynamicSecretLeaseDTO = {
|
||||
dynamicSecretName: string;
|
||||
projectSlug: string;
|
||||
ttl?: string;
|
||||
path: string;
|
||||
environmentSlug: string;
|
||||
config?: TDynamicSecretLeaseConfig;
|
||||
provider: DynamicSecretProviders;
|
||||
};
|
||||
|
||||
export type TRenewDynamicSecretLeaseDTO = {
|
||||
|
||||
Reference in New Issue
Block a user