Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
218b18b4
Commit
218b18b4
authored
1 year ago
by
des20
Browse files
Options
Downloads
Patches
Plain Diff
begin understending
parent
4012bfc7
No related branches found
No related tags found
No related merge requests found
Pipeline
#35154
failed
1 year ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/s3/aws.rb
+35
-7
35 additions, 7 deletions
app/services/s3/aws.rb
with
35 additions
and
7 deletions
app/services/s3/aws.rb
+
35
−
7
View file @
218b18b4
require
'aws-sdk-s3'
require
"json"
Aws
.
config
.
update
(
endpoint:
'https://s3.c3sl.ufpr.br'
,
access_key_id
:
'
GMHK6
00
49J0FT1ZC5EPT'
,
access_key_id:
'
GMHK6
OO
49J0FT1ZC5EPT'
,
secret_access_key:
'MyknbDcne4JRNCi6GJhDsSaH3No4TpdCzIjwcJ0K'
,
force_path_style:
true
,
region:
'default'
region:
'default'
,
)
bucket_name
=
"portalmecs3"
s3_client
=
Aws
::
S3
::
Client
.
new
buckets
=
s3_client
.
list_buckets
file
=
open
(
"/home/des20/hello.txt"
)
file_data
=
file
.
read
s3_client
.
put_object
(
key:
'hello.txt'
,
body:
file_data
,
bucket:
bucket_name
,
content_type:
'text/plain'
)
object
=
s3_client
.
get_object
(
key:
'hello.txt'
,
bucket:
'portalmecs3'
,
)
puts
object
.
body
.
read
# wrapper = Aws::S3::Object.new(bucket_name, 'hello.txt')
# obj_data = wrapper.getObjectContent
# puts obj_data
# s3_client.delete_object(
# key: 'hello.txt',
# bucket: 'portalmecs3',
# )
# buckets = s3_client.list_buckets
puts
'List of S3 buckets:'
buckets
.
each
do
|
bucket
|
puts
bucket
.
name
end
\ No newline at end of file
# puts 'List of S3 buckets:'
# buckets.each do |bucket|
# puts {bucket.name}\t{bucket.creation_date}
# end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment