Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/aws/s3_client.rb')
-rw-r--r--lib/aws/s3_client.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/aws/s3_client.rb b/lib/aws/s3_client.rb
new file mode 100644
index 00000000000..bdaea7efabf
--- /dev/null
+++ b/lib/aws/s3_client.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Aws
+ class S3Client
+ def initialize(access_key_id, secret_access_key, aws_region)
+ credentials = Aws::Credentials.new(access_key_id, secret_access_key)
+ @s3_client = Aws::S3::Client.new(region: aws_region, credentials: credentials)
+ end
+
+ def upload_object(key, bucket, body, content_type = 'application/json')
+ @s3_client.put_object(key: key, bucket: bucket, body: body, content_type: content_type)
+ end
+ end
+end