misc: connected aws add kms

This commit is contained in:
Sheen Capadngan
2024-07-30 23:01:13 +05:30
committed by =
parent 937b0c0a7c
commit 9c4bb79472
5 changed files with 139 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
export { useAddAwsExternalKms } from "./mutations";
+53
View File
@@ -0,0 +1,53 @@
import { useMutation } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
export const useAddAwsExternalKms = () => {
return useMutation({
mutationFn: async ({
slug,
description,
credentialType,
accessKey,
secretKey,
assumeRoleArn,
externalId,
awsRegion,
kmsKeyId
}: {
slug: string;
description: string;
credentialType: string;
accessKey?: string;
secretKey?: string;
assumeRoleArn?: string;
externalId?: string;
awsRegion: string;
kmsKeyId?: string;
}) => {
const { data } = await apiRequest.post("/api/v1/external-kms", {
slug,
description,
provider: {
type: "aws",
inputs: {
credential: {
type: credentialType,
data: {
accessKey,
secretKey,
assumeRoleArn,
externalId
}
},
awsRegion,
kmsKeyId
}
}
});
return data;
},
onSuccess() {}
});
};