mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add remaining bucket meta gets
This commit is contained in:
parent
279a9e7019
commit
4941d15424
5 changed files with 90 additions and 0 deletions
|
@ -70,6 +70,26 @@ module Fog
|
|||
)
|
||||
end
|
||||
|
||||
# Change who pays for requests to an S3 bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# bucket_name<~String>:: name of bucket to modify
|
||||
# payer<~String>:: valid values are BucketOwner or Requester
|
||||
def put_request_payment(bucket_name, payer)
|
||||
data = <<-DATA
|
||||
<RequestPaymentConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
||||
<Payer>#{payer}</Payer>
|
||||
</RequestPaymentConfiguration>
|
||||
DATA
|
||||
request(
|
||||
'PUT',
|
||||
url(bucket_name),
|
||||
Fog::Parsers::AWS::S3::BasicParser.new,
|
||||
{},
|
||||
data
|
||||
)
|
||||
end
|
||||
|
||||
# List information about objects in an S3 bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
|
@ -96,6 +116,24 @@ module Fog
|
|||
)
|
||||
end
|
||||
|
||||
# Get configured payer for an S3 bucket
|
||||
def get_request_payment(bucket_name)
|
||||
request(
|
||||
'GET',
|
||||
url(bucket_name, '?requestpayment'),
|
||||
Fog::Parsers::AWS::S3::GetRequestPayment.new
|
||||
)
|
||||
end
|
||||
|
||||
# Get location constraint for an S3 bucket
|
||||
def get_location(bucket_name)
|
||||
request(
|
||||
'GET',
|
||||
url(bucket_name, '?location'),
|
||||
Fog::Parsers::AWS::S3::GetRequestPayment.new
|
||||
)
|
||||
end
|
||||
|
||||
# Delete an S3 bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
|
|
|
@ -93,6 +93,28 @@ module Fog
|
|||
|
||||
end
|
||||
|
||||
class GetRequestPayment < Fog::Parsers::AWS::S3::BasicParser
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'Payer'
|
||||
@response[:payer] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class GetLocation < Fog::Parsers::AWS::S3::BasicParser
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'LocationConstraint'
|
||||
@response[:location_constraint] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
10
spec/aws/s3/get_location_spec.rb
Normal file
10
spec/aws/s3/get_location_spec.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||
|
||||
describe 'S3.get_location' do
|
||||
|
||||
it 'should return proper attributes' do
|
||||
p 'SHOULD CHECK FOR PROPER ATTRIBUTES'
|
||||
p s3.get_location('foggetlocation')
|
||||
end
|
||||
|
||||
end
|
10
spec/aws/s3/get_request_payment_spec.rb
Normal file
10
spec/aws/s3/get_request_payment_spec.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||
|
||||
describe 'S3.get_request_payment' do
|
||||
|
||||
it 'should return proper attributes' do
|
||||
p 'SHOULD CHECK FOR PROPER ATTRIBUTES'
|
||||
p s3.get_request_payment('foggetrequestpayment')
|
||||
end
|
||||
|
||||
end
|
10
spec/aws/s3/put_request_payment_spec.rb
Normal file
10
spec/aws/s3/put_request_payment_spec.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||
|
||||
describe 'S3.put_request_payment' do
|
||||
|
||||
it 'should return proper attributes' do
|
||||
p 'SHOULD CHECK FOR PROPER ATTRIBUTES'
|
||||
p s3.put_request_payment('fogputrequestpayment', 'Requester')
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Reference in a new issue