class Lexicon::Common::Remote::S3Client
Attributes
raw[R]
@return [Aws::S3::Client]
Public Class Methods
new(raw:)
click to toggle source
@param [Aws::S3::Client] raw
# File lib/lexicon/common/remote/s3_client.rb, line 11 def initialize(raw:) @raw = raw end
Public Instance Methods
bucket_exist?(name)
click to toggle source
@param [String] name @return [Boolean]
# File lib/lexicon/common/remote/s3_client.rb, line 24 def bucket_exist?(name) if raw.head_bucket(bucket: name) true else false end rescue StandardError false end
ensure_bucket_absent(name)
click to toggle source
@param [String] name
# File lib/lexicon/common/remote/s3_client.rb, line 35 def ensure_bucket_absent(name) if bucket_exist?(name) raw.delete_bucket(bucket: name) end end
ls(bucket)
click to toggle source
@return [Array<Object>]
# File lib/lexicon/common/remote/s3_client.rb, line 16 def ls(bucket) raw.list_objects_v2(bucket: bucket) .to_h .fetch(:contents, []) end