Class: Stax::Aws::S3

Inherits:
Sdk
  • Object
show all
Defined in:
lib/stax/aws/s3.rb

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

.bucket_tags(bucket) ⇒ Object



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

.clientObject



7
8
9
# File 'lib/stax/aws/s3.rb', line 7

def client
  @_client ||= ::Aws::S3::Client.new
end

.get_lifecycle(bucket) ⇒ Object



33
34
35
# File 'lib/stax/aws/s3.rb', line 33

def get_lifecycle(bucket)
  client.get_bucket_lifecycle_configuration(bucket: bucket).rules
end

.list_bucketsObject



11
12
13
# File 'lib/stax/aws/s3.rb', line 11

def list_buckets
  client.list_buckets.buckets
end

.put(opt) ⇒ Object



29
30
31
# File 'lib/stax/aws/s3.rb', line 29

def put(opt)
  client.put_object(opt)
end

.put_lifecycle(bucket, cfg) ⇒ Object



37
38
39
# File 'lib/stax/aws/s3.rb', line 37

def put_lifecycle(bucket, cfg)
  client.put_bucket_lifecycle_configuration(bucket: bucket, lifecycle_configuration: cfg)
end