Class: Stax::Aws::S3
Constant Summary
Constants inherited
from Sdk
Stax::Aws::Sdk::RETRY_LIMIT
Class Method Summary
collapse
Methods inherited from Sdk
paginate
Class Method Details
.bucket_region(bucket) ⇒ Object
25
26
27
|
# File 'lib/stax/aws/s3.rb', line 25
def bucket_region(bucket)
client.get_bucket_location(bucket: bucket).location_constraint
end
|
15
16
17
18
19
20
21
22
23
|
# File 'lib/stax/aws/s3.rb', line 15
def bucket_tags(bucket)
client.get_bucket_tagging(bucket: bucket).tag_set
rescue ::Aws::Errors::NoSuchEndpointError
warn("socket error for #{bucket}, retrying")
sleep 1
retry
rescue ::Aws::S3::Errors::NoSuchTagSet
[]
end
|
.client ⇒ Object
7
8
9
|
# File 'lib/stax/aws/s3.rb', line 7
def client
@_client ||= ::Aws::S3::Client.new
end
|
.get_lifecycle(bucket) ⇒ Object
39
40
41
|
# File 'lib/stax/aws/s3.rb', line 39
def get_lifecycle(bucket)
client.get_bucket_lifecycle_configuration(bucket: bucket).rules
end
|
.list_buckets ⇒ Object
11
12
13
|
# File 'lib/stax/aws/s3.rb', line 11
def list_buckets
client.list_buckets.buckets
end
|
.location(bucket) ⇒ Object
get region, return us-east-1 if empty
30
31
32
33
|
# File 'lib/stax/aws/s3.rb', line 30
def location(bucket)
l = client.get_bucket_location(bucket: bucket).location_constraint
l.empty? ? 'us-east-1' : l
end
|
.put(opt) ⇒ Object
35
36
37
|
# File 'lib/stax/aws/s3.rb', line 35
def put(opt)
client.put_object(opt)
end
|
.put_lifecycle(bucket, cfg) ⇒ Object
43
44
45
|
# File 'lib/stax/aws/s3.rb', line 43
def put_lifecycle(bucket, cfg)
client.put_bucket_lifecycle_configuration(bucket: bucket, lifecycle_configuration: cfg)
end
|