Class: Aws::S3Generator::Bucket
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#s3 ⇒ Object
readonly
Returns the value of attribute s3.
Class Method Summary collapse
-
.create(s3, name, expires = nil, headers = {}) ⇒ Object
Create new S3LinkBucket instance and generate creation link for it.
Instance Method Summary collapse
-
#create_link(expires = nil, headers = {}) ⇒ Object
Return a link to create this bucket.
-
#delete(expires = nil, headers = {}) ⇒ Object
Generate link to delete bucket.
-
#get(key, expires = nil, headers = {}) ⇒ Object
Generate link to GET key data.
-
#initialize(s3, name) ⇒ Bucket
constructor
Create new S3LinkBucket instance.
-
#key(name) ⇒ Object
Return a S3Generator::Key instance.
-
#keys(options = nil, expires = nil, headers = {}) ⇒ Object
Generate link to list keys.
-
#public_link ⇒ Object
Return a public link to bucket.
-
#put(key, meta_headers = {}, expires = nil, headers = {}) ⇒ Object
Generates link to PUT key data.
- #to_s ⇒ Object (also: #full_name)
Constructor Details
#initialize(s3, name) ⇒ Bucket
Create new S3LinkBucket instance.
981 982 983 |
# File 'lib/s3/right_s3.rb', line 981 def initialize(s3, name) @s3, @name = s3, name.to_s end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
959 960 961 |
# File 'lib/s3/right_s3.rb', line 959 def name @name end |
#s3 ⇒ Object (readonly)
Returns the value of attribute s3.
959 960 961 |
# File 'lib/s3/right_s3.rb', line 959 def s3 @s3 end |
Class Method Details
.create(s3, name, expires = nil, headers = {}) ⇒ Object
Create new S3LinkBucket instance and generate creation link for it.
976 977 978 |
# File 'lib/s3/right_s3.rb', line 976 def self.create(s3, name, expires=nil, headers={}) new(s3, name.to_s) end |
Instance Method Details
#create_link(expires = nil, headers = {}) ⇒ Object
Return a link to create this bucket.
987 988 989 |
# File 'lib/s3/right_s3.rb', line 987 def create_link(expires=nil, headers={}) @s3.interface.create_bucket_link(@name, expires, headers) end |
#delete(expires = nil, headers = {}) ⇒ Object
Generate link to delete bucket.
bucket.delete(2.hour)
1030 1031 1032 |
# File 'lib/s3/right_s3.rb', line 1030 def delete(expires=nil, headers={}) @s3.interface.delete_bucket_link(@name, expires, headers) end |
#get(key, expires = nil, headers = {}) ⇒ Object
Generate link to GET key data.
bucket.get('logs/today/1.log', 1.hour)
1022 1023 1024 |
# File 'lib/s3/right_s3.rb', line 1022 def get(key, expires=nil, headers={}) @s3.interface.get_link(@name, key.to_s, expires, headers) end |
#key(name) ⇒ Object
Return a S3Generator::Key instance.
bucket.key('my_cool_key').get #=> https://s3.amazonaws.com:443/my_awesome_bucket/my_cool_key?Signature=B...D&Expires=1180820032&AWSAccessKeyId=1...2
bucket.key('my_cool_key').delete #=> https://s3.amazonaws.com:443/my_awesome_bucket/my_cool_key?Signature=B...D&Expires=1180820098&AWSAccessKeyId=1...2
1005 1006 1007 |
# File 'lib/s3/right_s3.rb', line 1005 def key(name) Key.new(self, name) end |
#keys(options = nil, expires = nil, headers = {}) ⇒ Object
Generate link to list keys.
bucket.keys
bucket.keys('prefix'=>'logs')
996 997 998 |
# File 'lib/s3/right_s3.rb', line 996 def keys(=nil, expires=nil, headers={}) @s3.interface.list_bucket_link(@name, , expires, headers) end |
#public_link ⇒ Object
Return a public link to bucket.
bucket.public_link #=> 'https://s3.amazonaws.com:443/my_awesome_bucket'
970 971 972 973 |
# File 'lib/s3/right_s3.rb', line 970 def public_link params = @s3.interface.params "#{params[:protocol]}://#{params[:server]}:#{params[:port]}/#{full_name}" end |
#put(key, meta_headers = {}, expires = nil, headers = {}) ⇒ Object
Generates link to PUT key data.
puts bucket.put('logs/today/1.log', 2.hour)
1013 1014 1015 1016 |
# File 'lib/s3/right_s3.rb', line 1013 def put(key, ={}, expires=nil, headers={}) = Aws::S3::Key.() @s3.interface.put_link(@name, key.to_s, nil, expires, .merge(headers)) end |
#to_s ⇒ Object Also known as: full_name
961 962 963 |
# File 'lib/s3/right_s3.rb', line 961 def to_s @name end |