diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-06-05 22:30:51 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-06-09 21:48:00 +0800 |
commit | cc013584714e8ce1f583ce391f8123881e3c0297 (patch) | |
tree | 1ba356e34a048e39cc793f6705f5a4f4430bfe31 /deno/mail-relay/aws/context.ts | |
parent | fa62ea0367faea62904c0085c029cdbb18cf0857 (diff) | |
download | crupest-cc013584714e8ce1f583ce391f8123881e3c0297.tar.gz crupest-cc013584714e8ce1f583ce391f8123881e3c0297.tar.bz2 crupest-cc013584714e8ce1f583ce391f8123881e3c0297.zip |
feat(deno): move deno (mail-server) to top level.
Diffstat (limited to 'deno/mail-relay/aws/context.ts')
-rw-r--r-- | deno/mail-relay/aws/context.ts | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/deno/mail-relay/aws/context.ts b/deno/mail-relay/aws/context.ts deleted file mode 100644 index b1e0336..0000000 --- a/deno/mail-relay/aws/context.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { - CopyObjectCommand, - DeleteObjectCommand, - S3Client, -} from "@aws-sdk/client-s3"; -import { FetchHttpHandler } from "@smithy/fetch-http-handler"; - -import config from "../config.ts"; - -export class AwsContext { - readonly credentials = () => - Promise.resolve({ - accessKeyId: config.get("awsUser"), - secretAccessKey: config.get("awsPassword"), - }); - readonly requestHandler = new FetchHttpHandler(); - - get region() { - return config.get("awsRegion"); - } -} - -export async function s3MoveObject( - client: S3Client, - bucket: string, - path: string, - newPath: string, -): Promise<void> { - const copyCommand = new CopyObjectCommand({ - Bucket: bucket, - Key: newPath, - CopySource: `${bucket}/${path}`, - }); - await client.send(copyCommand); - - const deleteCommand = new DeleteObjectCommand({ - Bucket: bucket, - Key: path, - }); - await client.send(deleteCommand); -} |