MCPcopy Index your code
hub / github.com/CapSoftware/Cap / testOrganizationS3Config

Function testOrganizationS3Config

apps/web/actions/organization/storage.ts:427–451  ·  view source on GitHub ↗
(input: S3ConfigInput)

Source from the content-addressed store, hash-verified

425}
426
427export async function testOrganizationS3Config(input: S3ConfigInput) {
428 await requireOrganizationStorageManagerPro(input.organizationId);
429 const credentials = await getS3InputCredentials(input);
430 const controller = new AbortController();
431 const timeoutId = setTimeout(() => controller.abort(), 5000);
432 const s3Client = new S3Client({
433 endpoint: input.endpoint || undefined,
434 region: input.region,
435 credentials: {
436 accessKeyId: credentials.accessKeyId,
437 secretAccessKey: credentials.secretAccessKey,
438 },
439 });
440
441 try {
442 await s3Client.send(new HeadBucketCommand({ Bucket: input.bucketName }), {
443 abortSignal: controller.signal,
444 });
445 return { success: true };
446 } catch (error) {
447 throw new Error(getS3ConnectionErrorMessage(error, input.bucketName));
448 } finally {
449 clearTimeout(timeoutId);
450 }
451}
452
453export async function setOrganizationStorageProvider({
454 organizationId,

Callers 1

testS3Function · 0.90

Calls 5

getS3InputCredentialsFunction · 0.85
abortMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected